# 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

# Install the SDK

Add the Superwall KMP SDK to your Kotlin Multiplatform project.

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

## Requirements

| Target  | Requirement                                         |
| ------- | --------------------------------------------------- |
| Android | `minSdk` 26, `compileSdk` 36                        |
| iOS     | iOS 14+ (`iosArm64`, `iosSimulatorArm64`, `iosX64`) |
| Kotlin  | 2.3.10                                              |

Android is the shorter path: one Gradle dependency and you are done. iOS needs a second step, because the Kotlin framework does not embed the Swift bridge binary it compiles against.

## Android

Add the dependency to your shared module. Because the public API lives in `commonMain`, you can declare it there and both targets pick it up.

## Tab

```kotlin build.gradle.kts
kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation("com.superwall.sdk:superwall-kmp:0.1.1")
        }
    }
}
```

## Tab

```toml libs.versions.toml
[versions]
superwall-kmp = "0.1.1"

[libraries]
superwall-kmp = { module = "com.superwall.sdk:superwall-kmp", version.ref = "superwall-kmp" }

# And in your shared module's build.gradle.kts
# commonMain.dependencies { implementation(libs.superwall.kmp) }
```

`superwall-android` comes along transitively, so do not add it yourself.

> **Note:** **You do not need to edit `AndroidManifest.xml`.** This is the main way KMP install differs from the [standalone Android SDK](/docs/android/quickstart/install), whose docs ask you to declare the paywall activity and permissions by hand.The KMP library manifest already declares `SuperwallPaywallActivity`, and `superwall-android` declares the `INTERNET`, `ACCESS_NETWORK_STATE`, and `POST_NOTIFICATIONS` permissions. (`com.android.vending.BILLING` arrives from the Play Billing library.) Manifest merging folds all of it into your app.**Migrating from the standalone Android SDK?** Remove the `SuperwallPaywallActivity` declaration from your own manifest first. Keeping it will fail the manifest merger, because the KMP library declares the same activity with a different theme (`Theme.AppCompat.NoActionBar`). If you need your own theme, override it with `tools:replace="android:theme"` rather than declaring the activity twice.

### No `Context`, and what to do if that breaks

`Superwall.configure` takes no `Context` on Android. An `androidx.startup` initializer in the library manifest captures the `Application` before any of your code runs, which is what lets the `commonMain` signature stay platform-free.

If your app strips the startup provider (some apps remove `InitializationProvider` deliberately, and some shrinkers remove it by accident), that capture never happens and `configure()` fails with `SuperwallError.NotInitialized`. The fallback is an Android-only extension function:

```kotlin
// androidMain: only needed if the androidx.startup provider was removed
import com.superwall.sdk.kmp.androidSetup

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Superwall.androidSetup(this)
    }
}
```

It is idempotent, so calling it defensively alongside a working initializer is harmless.

## iOS

iOS is two steps. Miss the second one and the app fails to link.

### 1\. Export the Kotlin framework as static

In your shared module, the framework **must** be static:

```kotlin
// shared/build.gradle.kts
kotlin {
    listOf(iosArm64(), iosSimulatorArm64(), iosX64()).forEach {
        it.binaries.framework {
            baseName = "Shared"
            isStatic = true // required
        }
    }
}
```

> **Warning:** `isStatic = true` is required, not optional. The Kotlin framework compiles against the bridge's Objective-C headers only (compile-only cinterop) and never embeds the bridge binary, so a dynamic framework has nothing to resolve those symbols against at link time.

### 2\. Add the SuperwallKMPBridge Swift package

In Xcode: &#x2A;*File → Add Package Dependencies…**, then paste the repository URL:

```
https://github.com/superwall/Superwall-KMP
```

Add the &#x2A;*`SuperwallKMPBridge`** product to your app target.

![Xcode](https://superwall.com/docs/images/kmp/spm-add-bridge-product.jpg)

> **Note:** Xcode defaults the Dependency Rule to **Up to Next Major Version**, as shown. While the SDK is in
> beta, pin **Exact Version** instead. The bridge binary and the Kotlin klib ship from the same tag
> and are one release unit, so letting SPM drift ahead of the version your shared module was built
> against is what breaks the link step.

> **Warning:** **Do not add SuperwallKit separately.**The bridge package pins SuperwallKit iOS to exactly `4.16.1` and pulls it in transitively. The pinned binary and the headers the Kotlin side was compiled against are one release unit. Adding SuperwallKit yourself invites a version conflict that SPM cannot resolve.

> **Warning:** **A missing bridge is a build-time failure, not a runtime one.** Because the Kotlin side uses compile-only cinterop, forgetting this step surfaces as undefined-symbol link errors when Xcode builds your app, not as a crash on launch or a paywall that silently fails to present. If you see linker errors mentioning bridge symbols, this step is what is missing.

## Get your API key

You need your **Public API Key** from the Superwall dashboard, under your app's settings. It is safe to ship in client code.

Your Android and iOS apps are separate apps in the dashboard, and each has its own key. Since your `configure` call lives in shared code, it needs to receive the Android key on Android and the iOS key on iOS. [Getting the right API key](/docs/kmp/guides/platform-differences#getting-the-right-api-key) shows a pattern for this.

## Verify the install

Build both targets before you write any integration code. On iOS in particular, a successful build is the signal that step 2 landed:

```bash
./gradlew :shared:build
```

Then build the iOS app from Xcode.

<Check>
  **And you're done!**

   Now you're ready to 

  [configure the SDK](/docs/kmp/quickstart/configure)

   👇
</Check>