# 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

# Quickstart

Create a custom store and a product, then grant a test user access by sending one sandbox purchase event with curl.

This page sets up a custom store and proves it works with a single request. You don't need a server or a billing system yet. At the end, a test user holds an entitlement that your app can see.

## 1\. Create a store

In the dashboard, go to **Integrations › Custom stores** and click **Create custom store**. Name it after your billing system, such as `Paddle`.

Or use the [Superwall API](/docs/agents/api) with a key that has the `custom_stores:write` scope:

```bash
curl -X POST https://api.superwall.com/v2/projects/$PROJECT_ID/custom-stores \
  -H "Authorization: Bearer $SUPERWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Paddle"}'
```

The response's `id` is the **custom store ID**. You need it to send events.

## 2\. Add a product

On the store's page, click **Add product**. Add one product for each plan you sell, and attach each to an entitlement, such as `pro`.

* The **identifier** is what your server sends as `product_id`. Pick one you can map from your billing system, such as `pro_monthly`. It must be unique across all of the project's custom stores.
* The **price, period and trial** are what the paywall shows. Match them to the plan in your billing system.

Through the API, this needs a key with the `products:write` scope. The price is in the smallest currency unit, so `999` is $9.99:

```bash
curl -X POST https://api.superwall.com/v2/products \
  -H "Authorization: Bearer $SUPERWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "'"$PROJECT_ID"'",
    "store": "custom",
    "application_id": "'"$CUSTOM_STORE_ID"'",
    "identifier": "pro_monthly",
    "name": "Pro Monthly",
    "price": { "amount": 999, "currency": "USD" },
    "subscription": { "period": "month", "trial_period_days": 7 },
    "entitlements": ["'"$ENTITLEMENT_ID"'"]
  }'
```

## 3\. Create an API key for your server

On the store's page, under **Connect your server**, click **Create API key**. It opens **Settings › API Keys** with only the `custom_store_events:write` scope selected. Restrict the key to this project.

This key can only send events, so keep it separate from keys that manage your project. Store it on your server as `SUPERWALL_API_KEY`.

## 4\. Send a test purchase

The store's page shows this request under **Send a test purchase**, filled in with your store ID, a product and the current time. Copy it from there, or run this:

```bash
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)

curl -X POST https://api.superwall.com/v2/custom-stores/$CUSTOM_STORE_ID/events \
  -H "Authorization: Bearer $SUPERWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "event_id": "evt_test_1",
        "type": "initial_purchase",
        "app_user_id": "user_123",
        "product_id": "pro_monthly",
        "subscription_id": "sub_test_1",
        "transaction_id": "txn_test_1",
        "environment": "sandbox",
        "occurred_at": "'"$NOW"'",
        "purchased_at": "'"$NOW"'",
        "expires_at": "2030-01-01T00:00:00Z",
        "period_type": "normal",
        "price": { "amount": "9.99", "currency": "USD" }
      }
    ]
  }'
```

A `200` response lists one result per event:

```json
{
  "object": "custom_store_event_batch",
  "custom_store_id": "4821",
  "accepted": 1,
  "rejected": 0,
  "results": [{ "event_id": "evt_test_1", "status": "accepted" }]
}
```

If the result says `rejected`, its `error.code` and `error.param` name the problem. See [error codes](/docs/integrations/custom-stores/events#rejected-events).

> **Note:** The event's price is a decimal string in major units (`"9.99"`). The product's price in step 2 is an integer in the smallest unit (`999`). They're two different APIs.

## 5\. See the entitlement

`user_123` now holds the product's entitlement. Check it in either place:

* **In your app**: identify as the same user. The SDK fetches the user's entitlements from Superwall, and a paywall gated on that entitlement no longer shows.

  ```swift
  Superwall.shared.identify(userId: "user_123")
  ```

* **With the [Superwall CLI](/docs/agents/cli)**:

  ```bash
  superwall users entitlements user_123 --app <app>
  ```

  Once the user has opened your app, their page under **Users** in the dashboard lists the same entitlements.

Sandbox events grant access like production events. Revenue charts show them only when you filter to the **Sandbox** environment.

## 6\. End the test subscription

Send an `expiration` for the same `subscription_id`, with a new `event_id`. It carries no `price`:

```bash
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)

curl -X POST https://api.superwall.com/v2/custom-stores/$CUSTOM_STORE_ID/events \
  -H "Authorization: Bearer $SUPERWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "event_id": "evt_test_2",
        "type": "expiration",
        "app_user_id": "user_123",
        "product_id": "pro_monthly",
        "subscription_id": "sub_test_1",
        "transaction_id": "txn_test_1",
        "environment": "sandbox",
        "occurred_at": "'"$NOW"'",
        "purchased_at": "'"$NOW"'",
        "expires_at": null,
        "period_type": "normal"
      }
    ]
  }'
```

The user loses the entitlement. The app picks that up the next time it refreshes entitlements, such as when it comes to the foreground.

## Next steps

You've done by hand what your server will do for every purchase. Now automate it:

1. [Build the server](/docs/integrations/custom-stores/example-server) that creates checkouts and forwards your billing system's webhooks.
2. Add the product to a paywall, like any other product.
3. Set up your app: [iOS](/docs/ios/guides/custom-store-products) or [Android](/docs/android/sdk-reference/PurchaseController#custom-store-products).