# Superwall: Subscription Infrastructure for iOS, Android, and Web

Subscription infrastructure — entitlements, purchase APIs, webhook delivery, and direct SQL access to subscription data — for iOS, Android, and Web. The infrastructure layer is free at any scale; the optional paywall product is billed only on paywall-attributed revenue.

## Pricing

- **Infrastructure: free at any scale, every plan.** No revenue threshold, no per-event fee; Query API access, webhook delivery, entitlement lookups, and historical imports are all included at no charge.
- **Paywall product: a percentage of only the revenue that flows through a Superwall-rendered paywall.** Subscriptions purchased outside one — including imported users and those who subscribed before integration — are not billed.

Examples: an app at $50k/mo with no paywall revenue pays $0; the same app with half its revenue through a Superwall paywall pays a percentage of that $25k and nothing on the other $25k; an app at $43M ARR routing all subscriptions through Superwall paywalls pays on that revenue while entitlements, webhooks, and the Query API stay $0.

## Scale

$1.5B+ annual subscription revenue across 10,000+ apps. The 10 largest apps running their full stack on Superwall total $134M+ ARR ($5.7M–$43.7M each). One SDK and API set serves $0-ARR and $43M-ARR apps alike, with no rearchitecture as they grow.

## Infrastructure capabilities

- **Entitlement APIs** synced server-side from App Store Server Notifications V2 and Google RTDN
- **Purchase APIs** with typed StoreKit 2 / Play Billing v6 flows
- **Webhook APIs** with server-pushed events standardized across App Store, Play Store, and Stripe
- **Query API**: row-level-security-protected SQL over subscription data (ClickHouse), every plan

Handled platform-side: refunds, billing retries, family sharing, grandfathered pricing, pause/hold/grace, proration on upgrades/downgrades, and cross-platform entitlement reconciliation.

## Migration

Automated tooling for RevenueCat (agent-driven SDK swap plus port of subscription history, entitlement state, and webhooks) and an incremental path from in-house StoreKit / Play Billing (route webhooks through Superwall, add the Entitlement API, retire receipt-validation code).

## Paywall product (optional, separately billable)

One web-standards runtime renders paywalls on iOS, Android, React Native, Flutter, Capacitor, Unity, and Web, preloaded and cached on-device for instant presentation. Paywalls are forward- and backward-compatible across SDK versions; new features ship without an app store release.

## Architecture

Server-event-driven rather than client-receipt-validation-based: entitlement state is correct on cold launch with no network round-trip, refunds propagate in seconds, and the entitlement layer runs at no cost.

## Docs

* Migrate from RevenueCat: https://superwall.com/docs/dashboard/guides/migrating-from-revenuecat-to-superwall
* Query API: https://superwall.com/docs/dashboard/guides/query-clickhouse
* Webhooks: https://superwall.com/docs/integrations/webhooks
* Pricing: https://superwall.com/pricing

# Platform Differences

Where Android and iOS behavior is not one-to-one in the KMP SDK.

> **Warning:** **Beta**The KMP SDK is in beta and its API may change between releases.

The KMP SDK's public API is identical on both platforms: one signature, no platform types, no `expect`/`actual` of your own. But it wraps two different native SDKs, and in a handful of places they do not offer the same thing.

This page is the complete list. Everything not mentioned here behaves the same on Android and iOS.

## APIs that differ

| API                                             | Behavior                                                                                                                                                     |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `SuperwallDelegate.handleSuperwallDeepLink`     | **iOS only.** `superwall-android` has no equivalent delegate hook, so this is never invoked on Android.                                                      |
| `Superwall.consume(purchaseToken)`              | **Android.** Consumes a Play Billing purchase so it can be bought again. On iOS it echoes the token back unchanged.                                          |
| `IntegrationAttribute.FIREBASE_INSTALLATION_ID` | **iOS only.** `superwall-android` has no counterpart; setting it on Android is skipped and logs a warning. Every other `IntegrationAttribute` works on both. |

That is the whole list of behavioral gaps. Notably, customer info is **not** on it. See [below](#what-is-not-a-difference).

## Options that only apply to one platform

Setting one of these on the other platform is harmless. It is ignored.

**Android only**

| Option                                        | What it does                                                |
| --------------------------------------------- | ----------------------------------------------------------- |
| `SuperwallOptions.passIdentifiersToPlayStore` | Sends the raw `appUserId` to Play instead of a SHA-256 hash |
| `SuperwallOptions.useMockReviews`             | Enables mock review functionality                           |
| `PaywallOptions.preloadDeviceOverrides`       | Per-device-tier overrides for `shouldPreload`               |
| `PaywallOptions.onBackPressed`                | Callback for the hardware back button while a paywall shows |

**iOS only**

| Option                                                  | What it does                                            |
| ------------------------------------------------------- | ------------------------------------------------------- |
| `SuperwallOptions.shouldBypassAppTransactionCheck`      | Skips the app transaction check on launch               |
| `SuperwallOptions.maxConfigRetryCount`                  | Retry attempts for fetching configuration (default `6`) |
| `PaywallOptions.shouldShowWebRestorationAlert`          | Offers web restoration after a failed restore           |
| `PaywallOptions.shouldShowWebPurchaseConfirmationAlert` | Confirms a successful web checkout purchase             |

> **Note:** `PaywallOptions.transactionBackgroundView` works on **both** platforms, despite its KDoc saying
> "iOS only". `superwall-android` has the same option, and the KMP mapper wires it. `SPINNER` maps
> to the native spinner and `NONE` maps to the native `null` ("show nothing").

## Delegate threading

This is the difference most likely to cause problems, because it is a runtime behavior rather than a missing method.

`SuperwallDelegate` callbacks are **not** forced onto the main thread. They arrive on whatever thread the native SDK called from, which splits cleanly:

| Hooks                                                                                                                                                              | Android            | iOS  |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ | ---- |
| `willPresentPaywall`, `didPresentPaywall`, `willDismissPaywall`, `didDismissPaywall`, `handleCustomPaywallAction`, `paywallWillOpenURL`, `paywallWillOpenDeepLink` | Main               | Main |
| `subscriptionStatusDidChange`, `customerInfoDidChange`, `userAttributesDidChange`, `willRedeemLink`, `didRedeemLink`                                               | Background         | Main |
| `handleSuperwallEvent`, `handleLog`                                                                                                                                | **Not guaranteed** | Main |

So the paywall lifecycle hooks are safe for UI work everywhere. The rest are not, on Android.

> **Warning:** `handleSuperwallEvent` and `handleLog` have their own row because they are the least predictable. Neither adds a dispatcher hop on Android, so they run on whatever thread the SDK called from. `handleLog` is invoked inline wherever a log statement executes, which includes the main thread. `handleSuperwallEvent` inherits the context of the code that tracked the event. Usually that is a background thread, but do not rely on it in either direction: do not assume it is safe for UI, and do not assume it is off the main thread.

```kotlin
override fun handleSuperwallEvent(eventInfo: SuperwallEventInfo) {
    // Fine: forwarding to an analytics SDK.
    analytics.track(eventInfo.eventType.name)

    // NOT fine on Android: this is a background thread.
    // updateMyUi()
}
```

If you need UI from one of those, hop yourself, or collect a flow instead:

```kotlin
scope.launch(Dispatchers.Main) { updateMyUi() }
```

> **Note:** Collecting `Superwall.subscriptionStatusFlow` is usually the easier path when you want subscription
> changes to drive UI, but it is a plain `StateFlow`, so it delivers on *your* collector's context,
> not on main. Collect it from a main-dispatched scope (`collectAsState`, `viewModelScope`,
> `lifecycleScope`) and you are safe; collect it on `Dispatchers.IO` and you are not.

Two more things to plan for: delegate implementations should be **thread-safe** (the analytics hooks are not serialized against each other), and they run **synchronously on an SDK thread**, so blocking in one slows the SDK. Keep them short.

> **Note:** `PaywallPresentationHandler` closures and the `register` `feature` closure are a different story:
> those *are* delivered on the main thread on both platforms, deliberately, because they gate UI.

## Install differences

The two platforms do not take the same amount of setup. See [Install the SDK](/docs/kmp/quickstart/install) for the detail.

|                          | Android                                                                              | iOS                                                               |
| ------------------------ | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
| Steps                    | One Gradle dependency                                                                | Gradle dependency **plus** the `SuperwallKMPBridge` Swift package |
| Manifest / project edits | None. The library manifest declares the paywall activity and the startup initializer | Kotlin framework must be exported with `isStatic = true`          |
| Native SDK               | `superwall-android` 2.8.0, transitively                                              | SuperwallKit 4.16.1, pinned exactly by the bridge                 |
| Minimum                  | `minSdk` 26                                                                          | iOS 14                                                            |

## In-app paywall previews on Android

> **Warning:** The KMP library manifest declares `SuperwallPaywallActivity`, which is what paywall presentation needs. It does **not** declare the debug activities that the standalone Android SDK's [in-app paywall previews](/docs/android/quickstart/in-app-paywall-previews) rely on, and neither does `superwall-android`.If you need previews on Android, declare them in your own `AndroidManifest.xml`:```xml
> <activity android:name="com.superwall.sdk.debug.DebugViewActivity" />
> <activity android:name="com.superwall.sdk.debug.localizations.SWLocalizationActivity" />
> <activity android:name="com.superwall.sdk.debug.SWConsoleActivity" />
> ```This path is not yet verified end-to-end on KMP. If you try it, we would like to hear how it goes, so please [open an issue](https://github.com/superwall/Superwall-KMP/issues).

## Getting the right API key

Your Android app and your iOS app are separate apps in the Superwall dashboard, and each one has its own Public API Key. In a KMP project, though, `Superwall.configure` is usually called once, from shared code. That single call site needs to end up with the Android key when the app runs on Android and the iOS key when it runs on iOS.

One way to do that is Kotlin's `expect`/`actual`:

```kotlin
// commonMain
expect val superwallApiKey: String

// androidMain
actual val superwallApiKey: String = "pk_your_android_key"

// iosMain
actual val superwallApiKey: String = "pk_your_ios_key"

// commonMain: one call site, correct key on each platform
Superwall.configure(apiKey = superwallApiKey)
```

This is the same pattern the [sample app](https://github.com/superwall/Superwall-KMP/blob/main/sample/shared/src/commonMain/kotlin/com/superwall/sdk/kmp/sample/ApiKey.kt) uses. Passing the key in from each platform's entry point works just as well; use whatever your project already does for per-platform values.