# 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

# Feature Gating

Control access to premium features with Superwall placements.

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

## The idea

`Superwall.register` lets you register a [placement](/docs/dashboard/dashboard-campaigns/campaigns-placements) to access a feature that may or may not be paywalled later in time. Whether the user can access that feature without paying is a dashboard decision, not a code decision.

```kotlin
fun pressedWorkoutButton() {
    // Remotely decide if a paywall is shown, and whether
    // startWorkout() is a paid-only feature.
    Superwall.register(placement = "StartWorkout") {
        navigation.startWorkout()
    }
}
```

Given how cheap `register` is, we strongly recommend registering **all core functionality**. That is what lets you change what is gated without shipping an app update.

## What happens when you register

When you register a placement:

1. The SDK checks your campaigns for a matching audience filter.
2. If one matches and the user is not in a holdout, the assigned paywall is presented.
3. Once a user is assigned a paywall for an audience, they keep seeing that paywall until you remove it from the audience or reset assignments.
4. After the paywall closes, the SDK looks at the paywall's **Feature Gating** value, set in the paywall editor under **General → Feature Gating**:
   * **Non Gated**: the `feature` closure runs when the paywall is dismissed, whether they paid or not.
   * **Gated**: the `feature` closure runs only if the user is already paying, or begins paying.
5. If no paywall is configured for the placement, the feature runs immediately with no extra network calls.

## Gating with entitlements directly

Sometimes you need to branch on subscription state rather than gate a call. Read it synchronously:

```kotlin
import com.superwall.sdk.kmp.models.entitlements.SubscriptionStatus

if (Superwall.subscriptionStatus.isActive) {
    showProContent()
} else {
    showFreeContent()
}
```

Or collect the flow to keep UI in sync. See [Tracking subscription state](/docs/kmp/quickstart/tracking-subscription-state).

> **Note:** Prefer `register` with a `feature` closure over hand-rolled `if` checks where you can. The closure
> keeps the decision on the dashboard; an `if` statement hard-codes it into the build.

## Inspecting entitlements

`Superwall.entitlements` is an immutable snapshot:

```kotlin
val entitlements = Superwall.entitlements

entitlements.active     // Set<Entitlement>
entitlements.inactive   // Set<Entitlement>
entitlements.all        // Set<Entitlement>
entitlements.web        // Set<Entitlement>, granted via web checkout
```

Each `Entitlement` carries its `id`, `productIds`, `store`, expiry and renewal dates, and whether it is a lifetime purchase.

To resolve entitlements for specific products, use `getEntitlementsByProductIds`, which asks the native SDK on both platforms:

```kotlin
val granted = Superwall.getEntitlementsByProductIds(setOf("pro_monthly", "pro_annual"))
```

## Previewing the outcome

To adjust UI *before* a placement fires (hiding an upgrade button for users who would never see a paywall, for example), ask what registering would do:

```kotlin
val result = Superwall.getPresentationResult(placement = "StartWorkout")
```

This presents nothing. It just tells you what would happen.

Next, [track subscription state](/docs/kmp/quickstart/tracking-subscription-state).