Superwall Integration
Pattern B: Superwall UI + BillDog Billing
Superwall presents the paywall. BillDog runs the purchase and restore, validates the receipt, grants entitlements, tracks analytics and fires webhooks. The bridge is a Superwall PurchaseControllerbacked by BillDog, plus a subscription-status sync so Superwall knows what the user holds.
Division of responsibilities
Superwall
- Paywall design, remote layout changes and paywall experiments
- Placements, triggers and audience allocation
- Presentation, dismissal and paywall metrics
BillDog
- StoreKit 2 and Play Billing purchase and restore
- Receipt validation, entitlements, customer info and webhooks
- Web checkout and the return-link redemption
- Analytics for the forwarded Superwall events
Separate modules
io.billdog:billdog-integration-superwall on Android, BillDogSuperwallIntegration on iOS, and billdog_superwall once it ships) or an optional factory in the React Native package. The core SDKs do not depend on Superwall.Implementation by platform
Platforms and availability
- Android (superwall-android 2.x): available as
io.billdog:billdog-integration-superwallon Maven Central, at the same version as the BillDog Android SDK. Superwall 2.9 and later need BillDog 1.1.1-beta.5 or later: earlier bridges don't implement the purchase method Superwall 2.9 calls, so paywall purchases do nothing. - React Native / Expo (
expo-superwall1.7+, through itsexpo-superwall/compatentry point): available in@billdog.io/react-native1.1.0-beta.3 and later. Don't use@superwall/react-native-superwall2.x: it runs Superwall Android 2.1 on Play Billing 6, and BillDog needs Play Billing 8 or later. - iOS (SuperwallKit 4.0.3 and later 4.x; 4.14.0 or later with Xcode 26): available from BillDog 1.1.1-beta.5 as
BillDogSuperwallIntegration, on Swift Package Manager and CocoaPods, at the same version as the BillDog iOS SDK. - Flutter (superwallkit_flutter 2.6 and later 2.x): available from BillDog 1.1.1-beta.5 as
billdog_superwallon pub.dev, at the same version asbilldog_flutter.
There is no BillDog bridge for Unity, and none for Capacitor (Superwall has no Capacitor SDK). The Flutter sample below shows the API the bridge will ship with.
iOS (Swift Package Manager / CocoaPods) Available
Available from 1.1.1-beta.5. The bridge is its own package, so apps without Superwall never download SuperwallKit. Add BillDogSuperwallIntegration at the same version as the BillDog iOS SDK: it brings BillDogFull at that exact version and SuperwallKit 4.0.3 or later 4.x. With Xcode 26, resolve SuperwallKit 4.14.0 or later: older SuperwallKit releases don't compile with it.
// Package.swift (in Xcode: File > Add Package Dependencies, rule "Exact Version")
.package(url: "https://github.com/billdogai/billdog-ios-superwall.git", exact: "1.2.0-beta.1"),
.target(name: "MyApp", dependencies: [
.product(name: "BillDogSuperwallIntegration", package: "billdog-ios-superwall"),
])
# Podfile
pod 'BillDogSuperwallIntegration', '1.2.0-beta.1'If your app also adds billdog-ios-spm or the BillDogFull pod directly, use the same version for both.
CocoaPods trunk stops accepting new pods on 2 December 2026, so versions released after that are on Swift Package Manager only.
import SuperwallKit
import BillDogFull
import BillDogSuperwallIntegration
// 1. Configure BillDog (it owns StoreKit purchases)
BillDog.shared.configure(config: BillDogConfig(apiKey: "bd_public_live_xxxxxxxx"))
// 2. Create the bridge PurchaseController.
// entitlementMap: BillDog entitlement identifier -> Superwall entitlement id (unmapped ids pass through).
let purchaseController = SuperwallBillDogPurchaseController(entitlementMap: ["pro": "premium"])
// 3. Configure Superwall to delegate purchases to BillDog
Superwall.configure(apiKey: "pk_...", purchaseController: purchaseController)
// 4. Keep Superwall's subscription status in sync with BillDog entitlements
purchaseController.startSyncingSubscriptionStatus()Android (Kotlin / Gradle) Available
Add io.billdog:billdog-integration-superwall from Maven Central next tocom.superwall.sdk:superwall-android 2.x. Superwall is a compileOnly peer of the bridge: the version your app declares is the one that runs.
import android.app.Application
import com.superwall.sdk.Superwall
import io.billdog.core.BillDog
import io.billdog.integration.superwall.SuperwallBillDogPurchaseController
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
class MyApp : Application() {
// An app-wide scope: an Application has no lifecycleScope
val appScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
lateinit var purchaseController: SuperwallBillDogPurchaseController
override fun onCreate() {
super.onCreate()
// 1. Configure BillDog (it owns Play Billing purchases)
BillDog.configure(this, apiKey = "bd_public_live_xxxxxxxx")
// 2. Create the PurchaseController. It turns Superwall's base plan / offer
// into the matching Play offer token.
purchaseController = SuperwallBillDogPurchaseController(entitlementMap = mapOf("pro" to "premium"))
// 3. Configure Superwall (it needs the Application)
Superwall.configure(this, apiKey = "pk_...", purchaseController = purchaseController)
// 4. Keep Superwall's subscription status in sync with BillDog entitlements
purchaseController.startSyncingSubscriptionStatus(appScope)
}
}React Native / Expo (TypeScript) Available
The factory ships in @billdog.io/react-native 1.1.0-beta.3 and later. The package does not depend on Superwall: pass the Superwall module to createSuperwallPurchaseController, which returns a subclass of Superwall's own PurchaseController.
import * as SuperwallSDK from 'expo-superwall/compat';
import { BillDogConfiguration, createSuperwallPurchaseController } from '@billdog.io/react-native';
// 1. Configure BillDog
BillDogConfiguration.configure({ apiKey: 'bd_public_live_xxxxxxxx' });
// 2. Create the bridge purchase controller
const purchaseController = createSuperwallPurchaseController(SuperwallSDK, {
entitlementMap: { pro: 'premium' },
});
// 3. Configure Superwall with the controller
await SuperwallSDK.default.configure({ apiKey: 'pk_...', purchaseController });
// 4. Keep Superwall's subscription status in sync with BillDog entitlements.
// Returns an unsubscribe function.
const stopSyncing = purchaseController.startSyncingSubscriptionStatus();The bridge buys the base plan and offer the Superwall paywall selected (from @billdog.io/react-native 1.1.1-beta.5; earlier versions bought the product's default offer).
Flutter (Dart) Available
Add the optional billdog_superwall package (pub.dev, from 1.1.1-beta.5, the same version as billdog_flutter) next to billdog_flutter and superwallkit_flutter (verified against 2.6.0 and 2.8.0). billdog_flutter itself does not depend on Superwall.
import 'package:billdog_flutter/billdog_flutter.dart';
import 'package:billdog_superwall/billdog_superwall.dart';
import 'package:superwallkit_flutter/superwallkit_flutter.dart' as sw;
// 1. Configure BillDog
await BillDog.configure('bd_public_live_xxxxxxxx');
// 2. Create the bridge purchase controller
final purchaseController = SuperwallBillDogPurchaseController(
entitlementMap: {'pro': 'premium'},
);
// 3. Configure Superwall with the purchase controller
sw.Superwall.configure('pk_...', purchaseController: purchaseController);
// 4. Synchronize subscription status with BillDog entitlements
purchaseController.startSyncingSubscriptionStatus();Like React Native, the Flutter bridge buys a product's default Play offer. Use the native Android controller when paywalls sell specific offers.
Subscription status and entitlements
With a custom purchase controller Superwall stops tracking purchases itself, so it must be told which entitlements the user holds. startSyncingSubscriptionStatus() sets Superwall's subscription status from BillDog's active entitlements now and on every customer-info update (purchases, restores, renewals, web checkout redemptions). syncSubscriptionStatus() does it once, on demand.
BillDog entitlement identifiers are passed through unchanged. If your Superwall entitlements use different names, pass entitlementMap when you create the controller (shown above on every platform). With syncIdentity (default true) Superwall's user is identified as BillDog's app user id; an anonymous BillDog id is never sent.
Offering attribution
Superwall presents its own paywall, so BillDog cannot tell which BillDog offering a purchase came from. When a product is in several BillDog offerings (experiment arms, a seasonal offering), a purchase is otherwise credited to the first loaded offering that sells it. Pass offeringMap: the identifier of the BillDog offering behind each Superwall paywall identifier (the identifier set in the Superwall dashboard). Map each experiment variant's paywall to its own offering.
// iOS
SuperwallBillDogPurchaseController(offeringMap: ["spring_sale_paywall": "spring_sale"])
// Android
SuperwallBillDogPurchaseController(offeringMap = mapOf("spring_sale_paywall" to "spring_sale"))
// React Native
createSuperwallPurchaseController(SuperwallSDK, { offeringMap: { spring_sale_paywall: 'spring_sale' } })
// Flutter
SuperwallBillDogPurchaseController(offeringMap: {'spring_sale_paywall': 'spring_sale'})A purchase from the mapped paywall on screen is attributed to that offering's package selling the product, in purchase events and the purchase record. Every other purchase is attributed as before, by product: no Superwall paywall on screen, a paywall that is not mapped, or an offering that is not loaded or does not sell the product (the last two are logged as warnings on iOS and Android). React Native and Flutter learn which paywall is on screen from the events you pass to forwardSuperwallEvent (below), so attribution there needs that forwarding.
Paywall analytics
Forward Superwall's analytics events to BillDog so paywall funnels sit next to purchases, entitlements and revenue. Each event is tracked as superwall_<event> with its scalar parameters (strings, numbers, booleans).
// iOS — SuperwallDelegate
func handleSuperwallEvent(withInfo eventInfo: SuperwallEventInfo) {
purchaseController.forwardSuperwallEvent(eventInfo)
}
// Android — the bridge takes the event's name and params, so it compiles
// against both superwall-android 2.0 and later releases:
purchaseController.forwardSuperwallEvent(name = eventName, params = eventParams)
// React Native — SuperwallDelegate
handleSuperwallEvent(eventInfo: SuperwallEventInfo) {
void purchaseController.forwardSuperwallEvent(eventInfo);
}
// Flutter — SuperwallDelegate
@override
void handleSuperwallEvent(SuperwallEventInfo eventInfo) {
purchaseController.forwardSuperwallEvent(eventInfo);
}Web checkout from a Superwall paywall
Give a Superwall paywall button the custom action billdog_web_checkout:<productId> and forward custom actions from your SuperwallDelegate to the controller. The controller starts BillDog web checkout and dismisses the Superwall paywall once the purchase grants an entitlement. It returnsfalse for any other action name.
// iOS — opens checkout, redeems the token, syncs status, dismisses the paywall
func handleCustomPaywallAction(withName name: String) {
guard let presenter = Superwall.shared.presentedViewController else { return }
Task { await purchaseController.handleCustomPaywallAction(name: name, from: presenter) }
}
// Android — opens checkout; BillDog.handleDeepLink redeems the return link and
// the Superwall paywall is dismissed once the entitlement is active
// (appScope is the app-wide scope from the setup above; context is the current Activity)
override fun handleCustomPaywallAction(withName: String) {
appScope.launch { purchaseController.handleCustomPaywallAction(withName, context) }
}
// React Native
handleCustomPaywallAction(name: string) {
void purchaseController.handleCustomPaywallAction(name);
}
// Flutter
@override
void handleCustomPaywallAction(String name) {
purchaseController.handleCustomPaywallAction(name);
}When the checkout completes, the browser returns to the app on the BillDog checkout link (<app id>.billdog://checkout/success?token=…). Pass incoming links to the SDK (BillDog.handleDeepLink(uri) on Android and React Native, BillDog.shared.handleDeepLink(uri) on Flutter; on Flutter the bridge's own handleDeepLink(uri) also syncs Superwall's status). The SDK redeems the token and refreshes customer info, which updates Superwall's subscription status. On iOS the controller redeems the token itself before returning.
Was this page helpful?
Or rate this page: