# 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

# Making Purchases

Purchase any StoreKit product easily, with or without a paywall.

Making purchases of a consumable, non-consumable or subscription product in Superwall takes only one line. You can use this whether or not you are using Superwall's paywalls:

```swift
let result = await Superwall.shared.purchase(product)
```

This method takes a `StoreProduct` and returns a `PurchaseResult` so you can take action on the result. Here's an example from our demo app, [Caffeine Pal](https://github.com/superwall/CaffeinePal/blob/using-superwall-sdk/Caffeine%20Pal/Store%20and%20Models/CaffeineStore.swift#L121):

> **Warning:** `Superwall.shared.purchase(product)` is for StoreKit-backed products. For Custom Store Products on a paywall, handle the purchase in your [`PurchaseController`](/docs/ios/sdk-reference/PurchaseController) using `product.productIdentifier`. See [Custom Store Products](/docs/ios/guides/custom-store-products).

```swift
func purchase(_ product: StoreProduct) async throws {
    let result = await Superwall.shared.purchase(product)
    
    switch result {
    case .cancelled:
        throw CaffeinePalStoreFrontError.cancelled
    case .purchased:
        // In `handleSuperwallEvent` delegate method, we'll check if an espresso recipe was
        // Purchased and if it was, we'll add it to the purchased drinks set.
        print("Purchased product \(product.productIdentifier)")
    case .pending:
        throw CaffeinePalStoreFrontError.pending
    case .failed(let error):
        throw error
    }
}
```

> **Note:** For the SDK reference, check out this [page](/docs/ios/guides/advanced/direct-purchasing).

The flow looks like this:

1. Fetch your products.
2. Call `purchase` on any of them.
3. Respond to the result.

Here's an example:

### Fetch products

A `StoreProduct` can be fetched using its corresponding identifier from App Store Connect or a [StoreKit Configuration File](/docs/ios/guides/testing-purchases). Custom Store Products are loaded from paywalls and are not fetched with `products(for:)`. For example, `subscription.caffeinePalPro.monthly` here:

![](https://claude-centralize-agent-preamble-superwall-docs.staffbar.workers.dev/docs/images/dp_product_id.jpeg)

That product could be fetched like so:

```swift
let caffeineSub = await Superwall.shared.products(for: Set(["subscription.caffeinePalPro.monthly"]))
```

### Call purchase

Now, simply call `purchase`:

```swift
let result = await Superwall.shared.purchase(caffeineSub)
```

### Respond to result

Finally, respond to the result:

```swift
switch result {
case .cancelled:
    // user cancelled the purchase flow
case .purchased:
    // Purchase completed
case .pending:
    // Purchase in flight
case .failed(let error):
    // Couldn't purchase, check out the error
}
```

There are a number of additional ways to respond to a purchase outside of this `result`, depending on how the product was purchased (for example, within a paywall). For examples, see this [doc](/docs/ios/guides/advanced/viewing-purchased-products).