Launch offer for the first 500 accounts: $10K MTR free for 24 months + $100 credit →
    .io

    iOS SDK Integration Guide

    🎨 Unified Monetization, Engagement & Data SDK

    BillDog is an iOS SDK combining Paywalls & Billing, Product Analytics, In-App Messaging, and Surveys. It ships as one binary module, BillDogFull: you import that, then switch on the features you use at startup.

    View GitHub PackageSPM • CocoaPods • SwiftUI • iOS 15+

    Overview & Core Architecture

    Everything ships inside the single BillDogFull module — there is no separate analytics, paywall or auth module to import, and import BillDogAnalytics fails with “no such module”. The core manages customer profiles, cached entitlements and network state. Some features — analytics, in-app messages, virtual currency, auth — only run once you register them with BillDog.shared.use(module:); each section below says when.

    Project-Scoped Identifiers

    All identifiers (paywalls, offerings, products, surveys) are project-scoped. A project has two kinds of key: a test key (bd_public_test_…) for sandbox and a live key (bd_public_live_…) for production, and the identifier names stay the same when you switch between them. There is no staging key; leave environment at .production — the .staging case points at a host that is not publicly available.

    Step 1: Installation

    Add the Swift Package dependency to your app via Xcode or in your Package.swift dependencies:

    dependencies: [
        .package(url: "https://github.com/billdogai/billdog-ios-spm.git", from: "1.2.0-beta.1")
    ],
    targets: [
        .target(name: "YourApp", dependencies: [
            .product(name: "BillDogFull", package: "billdog-ios-spm")
        ])
    ]

    Requirements: iOS 15.0 or later. The package manifest declares swift-tools-version 5.7, but the binaries are built with Swift 6.3 (Xcode 26), so build with that Xcode or newer.

    Or use CocoaPods in your Podfile:

    pod 'BillDogFull', '>= 1.2.0-beta.1'

    The requirement must name the pre-release — CocoaPods only selects a pre-release when the requirement itself names one, so an unversioned pod 'BillDogFull' will not pick it up. Import the single BillDogFull module.

    CocoaPods trunk stops accepting new pods on 2 December 2026. BillDog versions released after that are on Swift Package Manager only: use SPM for a new project, and move a CocoaPods app to SPM to keep updating. React Native, Expo and Flutter apps are not affected.

    Engagement-only apps use the BillDogEng product instead. Its entry point is different — BillDogEngSDK, not BillDog.shared, which does not exist there — so the code on this page does not apply to it; see the BillDogEng guide.

    Step 2: Initialize BillDog

    Configure the SDK once at startup in your custom AppDelegate or App struct, then register the analytics module. That registration is required: trackEvent hands events to the analytics module, so without it no analytics event, including every trackEvent call, reaches BillDog.

    Use your project’s public key (bd_public_test_… or bd_public_live_…). The secret key (bd_secret_…) is for your server only; never ship it in an app.

    import SwiftUI
    import BillDogFull
    
    /// One analytics module for the app, used by the snippets below.
    enum Analytics { static let shared = BillDogAnalyticsManager() }
    
    @main
    struct MyApp: App {
        init() {
            // Configure core SDK
            BillDog.shared.configure(
                config: BillDogConfig(
                    apiKey: "YOUR_API_KEY_HERE",
                    enableLogging: true,
                    environment: .production
                )
            )
    
            // Register the analytics module. Required on SDK 1.1.0-beta.3 and
            // earlier: without it no analytics event leaves the device, trackEvent
            // calls included. Later versions register it in configure(); this line
            // then makes your instance the one in use, so it is safe on every version.
            BillDog.shared.use(module: Analytics.shared)
        }
        
        var body: some Scene {
            WindowGroup {
                ContentView()
            }
        }
    }

    Step 3: Manage Customer Identity

    Associate sessions with authenticated users to synchronize entitlement states and analytics across devices:

    This links a user you have already authenticated elsewhere. If you would rather BillDog signed them in — password, email or SMS code, Google, Apple, passkeys, second factors, organizations — see BillDog Auth. The session it issues carries the user’s entitlements in the token, so your backend gates a paid feature with a claim check instead of a round-trip. See the 🔐 Authentication module below.

    // Link session to authenticated account
    Task {
        do {
            let result = try await BillDog.shared.identify(userId: "user_uuid_123")
            print("User login successful: \(result.customerInfo.entitlements.filter { $0.isActive }.map { $0.identifier })")
        } catch {
            print("Failed to identify user: \(error)")
        }
    }
    
    // Reset identity on user logout (switches to a NEW anonymous ID, not the
    // one this install had before sign-in)
    BillDog.shared.logOut()

    Step 4: Check Entitlements & Customer Info

    Verify feature access dynamically using cached customer details:

    Task {
        do {
            let customerInfo = try await BillDog.shared.getCustomerInfo()
            let hasPremium = customerInfo.hasEntitlement("premium")
            if hasPremium {
                // Unlock features
            }
        } catch {
            print("Failed to retrieve entitlements: \(error)")
        }
    }

    🔌 Feature Modules Guides

    Click on any module below to view detailed code snippets and APIs:

    💳 Paywalls & Billing (BillDog.shared)

    Display Native SwiftUI / UIKit Paywalls or route purchasing through your own billing provider:

    1. Present SwiftUI Paywall Sheet

    import SwiftUI
    import BillDogFull
    
    struct ContentView: View {
        @State private var showPaywall = false
        @State private var paywallConfig: PaywallConfiguration?
        
        var body: some View {
            let button = Button("Show Paywall") {
                Task {
                    do {
                        paywallConfig = try await BillDog.shared.fetchPaywall(identifier: "premium_offer")
                        showPaywall = true
                    } catch {
                        print("Failed to fetch paywall: \(error)")
                    }
                }
            }
            if let config = paywallConfig {
                // .paywall presents it as a sheet (or full screen, per its display
                // style): a purchase tap runs BillDog.purchase, restore restores,
                // and the close button dismisses it.
                button.paywall(isPresented: $showPaywall, configuration: config)
            } else {
                button
            }
        }
    }

    Use the .paywall modifier rather than putting PaywallView in your own .sheet. A bare PaywallView only reports taps to its onButtonPress callback: a purchase tap arrives as (productId, "purchase") and buys nothing, and the close button arrives as "close" for you to handle.

    2. Present UIKit Paywall

    BillDog.shared.presentPaywall(
        identifier: "premium_monthly",
        from: self,
        handler: PaywallPresentationHandler(
            onPresent: { paywallId in
                print("Paywall presented: \(paywallId)")
            },
            onDismiss: { paywallId in
                print("Paywall dismissed: \(paywallId)")
            },
            onPurchaseSuccess: { productId in
                print("Purchase complete: \(productId)")
                return .close
            }
        )
    )

    3. Register a Placement

    A placement is a named spot in your app (“onboarding”, “export_pdf”). Register it and BillDog shows the paywall the dashboard assigns to it. A gated placement answers .entitled without showing anything when the customer already holds the entitlement it requires; .holdout means the customer is in the placement’s holdout group and saw nothing. See Placements.

    // async — presents from the top view controller
    Task {
        do {
            let result = try await BillDog.shared.register(placement: "onboarding")
            switch result {
            case .entitled, .purchased, .restored:
                unlockFeature()
            case .error(let error):
                print("Placement failed: \(error)")
            default:
                break // dismissed, or in the holdout group: keep it locked
            }
        } catch {
            print("Placement failed: \(error)")
        }
    }
    
    // UIKit — present from a specific view controller
    BillDog.shared.register(placementId: "onboarding", from: self) { result in
        if case .purchased(let productId) = result {
            print("Purchased \(productId)")
        }
    }

    4. Custom Purchase Controller (your own StoreKit code, RevenueCat)

    When your own code buys through StoreKit, pass BillDog a controller. Paywall buttons and BillDog.shared.purchase(...) then call it, and BillDog records each App Store purchase it returns: the server verifies the transaction with Apple, so the purchase reaches revenue and entitlements. Return the purchase’s App Store transaction, either as its id in .purchased or, better, as evidence:

    import StoreKit
    
    final class MyPurchaseController: PurchaseControllerProtocol {
        func purchase(request: PurchaseRequest) async throws -> PurchaseOutcome {
            // StoreKit.Product: BillDogFull has a Product type of its own.
            guard let product = try await StoreKit.Product.products(for: [request.params.productId]).first else {
                return PurchaseOutcome(.failed(error: .productNotFoundError(productId: request.params.productId)))
            }
            var options: Set<StoreKit.Product.PurchaseOption> = []
            // Optional: binds the purchase to this customer.
            if let token = request.storeAccountToken { options.insert(.appAccountToken(token)) }
    
            switch try await product.purchase(options: options) {
            case .success(let verification):
                guard case .verified(let transaction) = verification else {
                    return PurchaseOutcome(.failed(error: .receiptVerificationFailed(
                        transactionId: nil, message: "StoreKit could not verify the transaction")))
                }
                await transaction.finish()   // your controller finishes; BillDog never does
                return PurchaseOutcome(
                    .purchased(transactionId: String(transaction.id), productId: transaction.productID),
                    evidence: [StoreEvidence(verification)]
                )
            case .userCancelled:
                return PurchaseOutcome(.cancelled)
            case .pending:
                return PurchaseOutcome(.pending)
            @unknown default:
                return PurchaseOutcome(.cancelled)
            }
        }
    
        // Required by the protocol; BillDog calls purchase(request:) above.
        func purchase(productId: String) async throws -> PurchaseResult {
            try await purchase(request: PurchaseRequest(params: PurchaseParams(productId: productId))).result
        }
    
        func restorePurchases() async throws -> RestoreResult {
            try await AppStore.sync()
            var items: [RestoredPurchase] = []
            for await case .verified(let transaction) in Transaction.currentEntitlements {
                items.append(RestoredPurchase(transactionId: String(transaction.id), productId: transaction.productID))
            }
            return .restored(items: items)
        }
    
        var storeKitVersion: HostStoreKitVersion { .storeKit2 }
    }
    
    BillDog.shared.configure(
        config: BillDogConfig(apiKey: "YOUR_API_KEY_HERE"),
        purchaseController: MyPurchaseController()
    )

    With a controller, your code owns the transaction: it finishes it, and BillDog never finishes or acknowledges it. A .purchased result with no evidence and an id that is not an App Store transaction id (a Stripe charge id, say) records nothing.

    Stripe, Paddle and other non-store billing are not recorded from the app: BillDog does not accept a purchase the app asserts without a store transaction behind it. Record them from your server with your secret key (POST /v1/record-external-purchase).

    5. Detailed Purchase Parameters (StoreKit 2)

    let params = PurchaseParams.Builder(productId: "pro_yearly")
        .with(promoOfferId: "intro_2024")
        .with(winBackOfferId: "winback_30off")
        .build()
    
    let result = try await BillDog.shared.purchase(params: params)

    The builder’s appAccountToken and isPersonalizedOffer are deprecated on iOS, which ignores both: the SDK places the customer’s own App Store account token itself, and StoreKit has no personalized-price option. A custom purchase controller still receives them in request.params.

    6. Restore Purchases

    Task {
        do {
            switch try await BillDog.shared.restorePurchases() {
            case .restored(let items):
                // The App Store purchases BillDog recorded; empty when there was nothing to restore
                print("Restored \(items.count) purchase(s)")
            case .failed(let error):
                // Returned, not thrown: the server refused every purchase it was sent
                print("Restore failed: \(error)")
            }
            // Entitlements come from the server: re-read them
            let customerInfo = try await BillDog.shared.getCustomerInfo()
            if customerInfo.hasEntitlement("premium") {
                // Unlock features
            }
        } catch {
            print("Restore failed: \(error)")   // thrown only when BillDog isn't configured
        }
    }

    Call it only from a user action: it asks the App Store for the latest transactions, which can show the App Store sign-in sheet. A paywall presented with the .paywall modifier already routes its own restore button to the SDK; call restorePurchases() yourself for a “Restore Purchases” control elsewhere in your app (App Review expects a restore mechanism).

    📊 Product Analytics (BillDogAnalyticsManager)

    Track custom events, register super properties, and configure compliance filters (GDPR / App Store):

    1. Track Events & Revenue

    // Simple event tracking via facade
    BillDog.shared.trackEvent("song_played", properties: ["genre": "synthwave"])
    
    // Track revenue/purchases
    let analytics = Analytics.shared   // the module registered at startup
    analytics.trackRevenue(amount: 9.99, currency: "USD", productId: "gold_pack")

    2. Advanced Super Properties

    // Register super properties (attached to all events)
    analytics.registerSuperProperties(["device_type": "tablet"])
    
    // Register super properties ONLY if not already set
    analytics.registerSuperPropertiesOnce(["initial_referrer": "google"])
    
    // Unregister a specific property
    analytics.unregisterSuperProperty("initial_referrer")
    
    // Clear all super properties
    analytics.clearSuperProperties()

    3. Advanced User Property Operations

    analytics.setUserProperties(["membership": "gold"])
    analytics.incrementUserProperty("games_played", by: 1.0)
    analytics.unionUserProperty("completed_milestones", values: ["tutorial_done", "level_10"])

    4. Identity Aliasing

    // Link current distinct ID to a new user account ID
    analytics.alias(newId: "user_uuid_123", previousId: analytics.getDistinctId())

    5. Manual Queue Flushing & Timed Events

    // Get current active Distinct ID
    let distinctId = analytics.getDistinctId()
    
    // Trigger manual queue flush to send events to server immediately
    analytics.flush()
    
    // Timed Event
    analytics.timeEvent("level_completed")
    // ... level completes ...
    analytics.track(event: BillDogAnalyticsEvent(name: "level_completed", properties: [:]))

    6. Event Filtering & Transformation (Plugins)

    class DataMaskingPlugin: AnalyticsPlugin {
        func process(event: BillDogAnalyticsEvent) -> BillDogAnalyticsEvent? {
            var properties = event.properties
            if event.name == "debug_event" { return nil } // Drop event
            if properties.keys.contains("email") { properties["email"] = "[REDACTED]" }
            return BillDogAnalyticsEvent(name: event.name, properties: properties, timestamp: event.timestamp)
        }
    }
    
    // Add the custom plugin to the analytics flow
    analytics.addPlugin(DataMaskingPlugin())

    7. Privacy-First Autocapture & Exceptions (Off by default)

    // Session and screen tracking: switch them on in the config...
    BillDog.shared.configure(
        config: BillDogConfig(
            apiKey: "YOUR_API_KEY_HERE",
            autoTrackSessions: true,     // true/false wins over the dashboard; omit to follow it
            autoTrackScreenViews: true   // independent of session tracking
        )
    )
    
    let analytics = Analytics.shared   // registered with BillDog.shared.use(module:)
    
    // ...or at runtime, at any time. A runtime call wins over the config and the
    // dashboard, and takes effect immediately.
    analytics.enableSessionTracking()
    analytics.enableScreenTracking()
    
    // Tap autocapture with automatic text masking...
    analytics.enableAutocapture(AutocaptureConfig(enabled: true, maskAllText: true))
    // ...and uncaught exception logging without breaking crash reporting
    analytics.enableExceptionAutocapture()

    This replaces the plain use(module:) call from Step 2 — register the analytics module once.

    📹 Session Replay (BillDog.shared.replay)

    Record user sessions as high-fidelity masked screenshot replays (Off by default):

    1. Start Replay Capture

    // projectId is your BillDog project's ID: the UUID in the dashboard URL
    // (/dashboard/projects/<id>). It must be the project your API key belongs
    // to — the server rejects every chunk whose project doesn't match the key.
    // Not BillDogConfig.projectId: that is BillDog's backend reference.
    var options = BillDogReplayOptions(projectId: "YOUR_PROJECT_ID")
    options.triggerMode = .session
    options.maskAllText = true
    options.maskAllImages = true
    
    let replay = BillDog.shared.replay
    replay.configure(options)
    
    // Start recording
    replay.start()

    2. UI Redaction

    Control what gets recorded in your layouts:

    • Set accessibilityIdentifier to billdog-replay-mask on any views containing sensitive data to pixel-redact them.
    • Or programmatically mask views using replay.maskView(myView).
    • Secure text input and password fields are automatically masked out-of-the-box.

    💬 In-App Messaging (BillDogInAppMessagesManager)

    Trigger customized banners, alerts, or full-screen modals configured via the dashboard:

    import BillDogFull
    
    // Register the module once, after configure. Unregistered, every
    // checkForMessages call is dropped as "Not configured".
    BillDog.shared.use(module: BillDogInAppMessagesManager.shared)
    
    let messages = BillDogInAppMessagesManager.shared
    
    // Trigger dialog message matching the trigger key
    messages.checkForMessages(trigger: "checkout_abandoned")
    
    // Suppress message display (e.g. during checkout flow)
    messages.paused = true

    📝 Surveys (BillDogSurveyPresenter)

    Show user feedback surveys with branching logic. present takes the presenting UIViewController — from SwiftUI, pass the view controller that hosts your view:

    import BillDogFull
    
    // Inside a UIViewController: `self` is the presenting view controller
    if let presenter = BillDog.getSurveyPresenter() {
        presenter.present(
            surveyId: "post_purchase_feedback",
            from: self,
            customerId: "user-123"
        )
    }

    🔔 Push Notifications (BillDogNotificationsManager)

    Sync APNs device registration tokens and manage consent overrides:

    import BillDogFull
    
    let notifications = BillDogNotificationsManager.shared
    
    // Set consent
    notifications.setConsentRequired(true)
    notifications.setConsentGiven(true)
    
    // In your AppDelegate: register the APNs token with BillDog
    func application(_ application: UIApplication,
                     didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        Task {
            do {
                // Registers the token for this install's customer (the one
                // configure() set up, or the one identify() named).
                try await BillDog.shared.setDeviceToken(deviceToken)
            } catch {
                print("Push token registration failed: \(error)")
            }
        }
    }

    setDeviceToken is what registers the device for push. notifications.pushSubscription.updateToken(_:) only records the token on the device and sends nothing to BillDog.

    Notification Service Extension (images, buttons, delivery receipts)

    iOS only lets an app touch a push before it is shown through a Notification Service Extension. BillDog ships one: it downloads the push's image, applies its action-button category and grouping, and reports the push as delivered. Without it, pushes still arrive and opens are still counted, but iOS shows no image or buttons and the dashboard marks an iOS push delivered only when someone opens it.

    1. In Xcode, add a target: File → New → Target → Notification Service Extension.
    2. Link the BillDog SDK to that target too, and make its service class BillDog's:
    import BillDogFull   // or BillDogEng
    
    class NotificationService: BillDogNotificationServiceExtension {
        // No overrides needed.
    }
    1. Add the App Groups capability to both the app target and the extension target, with the same group (for example group.com.example.app). The app saves your project URL and API key there; the extension reads them to report deliveries.
    2. Tell BillDog the group: add the key BillDogAppGroupIdentifier with that group id to both Info.plist files. Or set it in code in the app before BillDog.configure, and in the extension before super.didReceive:
    <!-- App Info.plist AND extension Info.plist -->
    <key>BillDogAppGroupIdentifier</key>
    <string>group.com.example.app</string>
    
    // or, in code (app: before BillDog.configure)
    BillDogNotificationDeliveryConfig.appGroupIdentifier = "group.com.example.app"

    If either target lacks the group, delivery reports are skipped without an error. The extension never reads a URL or key from the push itself, so a push cannot send your key elsewhere. Flutter, React Native and Expo apps add the extension the same way, in their ios/ project.

    🪙 Virtual Currency (BillDogVirtualCurrencyManager)

    Read server-synced wallet balances in the app; grant currency from your server:

    import BillDogFull
    
    // Register the module once, after configure — until then every call throws
    BillDog.shared.use(module: BillDogVirtualCurrencyManager.shared)
    
    let wallet = BillDogVirtualCurrencyManager.shared
    
    Task {
        do {
            // Every active currency, with this customer's balance in it
            for entry in try await wallet.getAllCurrencies() {
                print("\(entry.currency.name) (\(entry.currency.id)): \(entry.balance)")
            }
    
            // One currency, by its id or its code
            let balance = try await wallet.getBalance(currencyId: "COINS")
            print("Balance: \(balance)")
        } catch {
            print("Wallet operation failed: \(error)")
        }
    }

    Grant currency from your server, not the app. Writing to a wallet needs your project’s secret key, and the publishable key in the app is refused with 403. The wallet in the SDK is read-only, as in RevenueCat: addBalance, deductBalance, grantCurrency, exchangeCurrency and resetBalance are deprecated and throw a configurationError at once, without a request (Flutter and React Native do not offer them). Never ship the secret key in the app; call the API from your backend instead, then read the new balance in the app:

    curl -X POST https://api.billdog.io/v1/virtual-currency/transactions \
      -H "X-BillDog-API-Key: $BILLDOG_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "app_user_id": "user_uuid_123",
        "currency_id": "YOUR_CURRENCY_ID",
        "amount": 100,
        "type": "GRANT",
        "reason": "onboarding_reward"
      }'

    app_user_id is the id you passed to identify. The answer carries the new balance.

    🔐 Authentication (BillDogAuth)

    Requires 1.0.2-beta.3 or later (use 1.2.0-beta.1). Any BillDogFull /BillDogEng binary released before the auth module was written (the 2026-08-08 build) does not contain it at all, so a pod install or SPM resolution pinned to an older version yields a binary with no auth in it.

    BillDogAuth is part of both products, so import BillDogFull (or import BillDogEng) is enough. Neither registers it for you: register it once after configure, on BillDogFull with BillDog.shared.use(module:) and on BillDogEng with BillDogEngSDK.use(module:).

    1. Register the module

    // BillDogFull
    BillDog.shared.use(module: BillDogAuth.shared)
    
    // BillDogEng
    BillDogEngSDK.use(module: BillDogAuth.shared)

    2. Sign someone in

    do {
        let session = try await BillDogAuth.shared.attempt(
            identifier: "ada@example.com",
            strategy: .password,
            password: password
        )
        print(session)
    } catch BillDogAuth.AuthError.mfaRequired(let token, _) {
        // First factor accepted. Finish with the second, passing the token back.
        // A WRONG CODE INVALIDATES IT — restart at the first factor, never retry
        // with the same token.
        let session = try await BillDogAuth.shared.attempt(
            identifier: "ada@example.com",
            strategy: .totp,
            code: code,
            mfaToken: token
        )
        print(session)
    } catch BillDogAuth.AuthError.invalidCredentials {
        // Deliberately identical whether or not the identifier exists.
    }

    3. Passwordless, and phone numbers

    // A RETURNING user gets a fresh code from requestCode — signUp issues one
    // only for a NEW identifier.
    try await BillDogAuth.shared.requestCode(identifier: "+15551234567", kind: "phone")
    
    let session = try await BillDogAuth.shared.attempt(
        identifier: "+15551234567",
        kind: "phone",          // REQUIRED — selects the identity row
        strategy: .smsCode,
        code: code
    )

    kind defaults to "email" and selects the identity row. A phone sign-in that omits it looks a phone number up among email addresses, matches nothing, and returns the same opaque “credentials are not valid” as a wrong password.

    4. Restoring and ending a session

    if let session = await BillDogAuth.shared.restore() { }  // nil is ordinary
    BillDogAuth.shared.hasStoredSession   // nil + true: offline/server error, still signed in
    BillDogAuth.shared.isSignedIn
    BillDogAuth.shared.authHeaders                          // for your own API
    await BillDogAuth.shared.signOut()                      // "this" | "others" | "all"

    The refresh token lives in the Keychain; the session token stays in memory and is refreshed for you. Organizations (organizations(), createOrganization(name:), …) and passkeys (registerPasskey(), signInWithPasskey(), iOS 16+) are methods on BillDogAuth.shared, not separate types.

    5. Sign-up, password reset and account deletion

    // Sign-up sends a code; attempt(strategy: .emailCode) completes it
    try await BillDogAuth.shared.signUp(
        identifier: "ada@example.com",
        password: password,
        invitationToken: inviteToken,   // required when the project is invite-only
        captchaToken: captchaToken      // required when bot protection is on
    )
    
    // Password reset: request a code, then present it with the new password
    try await BillDogAuth.shared.requestPasswordReset(identifier: "ada@example.com")
    try await BillDogAuth.shared.resetPassword(
        identifier: "ada@example.com",
        code: code,
        newPassword: newPassword
    )
    
    // Delete the signed-in user's own account (App Store Guideline 5.1.1(v)).
    // Returns true or throws; on success this device is signed out.
    _ = try await BillDogAuth.shared.deleteAccount()

    Full detail: BillDog Auth, Sessions & Tokens, Multi-Factor.

    Next Steps

    Quick Start Interactive Tutorial

    iOS SDK Setup

    Follow these steps to quickly integrate BillDog into your iOS app

    1

    Add Dependencies

    // Add SPM package dependency:
    https://github.com/billdogai/billdog-ios-spm.git

    Add the BillDog SDK package via Swift Package Manager or CocoaPods.

    2

    Configure BillDog

    import BillDogFull
    
    // Initialize in AppDelegate or App init
    BillDog.shared.configure(
        config: BillDogConfig(
            apiKey: "YOUR_API_KEY_HERE"
        )
    )
    3

    Present Paywall

    // Fetch the configuration, then present it with the .paywall modifier
    let config = try await BillDog.shared.fetchPaywall(identifier: "premium_offer")
    
    Button("Upgrade") { showPaywall = true }
        .paywall(isPresented: $showPaywall, configuration: config)

    Example: SDK Client Snippet

    An editable snippet to adapt and copy into your app. Nothing runs in the browser.

    iOS SDK Client

    iOS • swift • editable snippet

    Was this page helpful?

    Or rate this page:

    We use cookies and process your data to provide our services. By continuing, you agree to our Terms and Privacy Policy.