# 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

# Configuration

Everything definePaywall accepts — products, presentation, transitions, trial reminders, and the behavior settings that shape a paywall.

Every paywall declares itself in a required `config.ts`: its dashboard name, its products, and any behavior settings. This file is the whole truth for the paywall — nothing is inherited from anywhere else.

```ts
import { definePaywall } from "superwall/config";

export default definePaywall({
  name: "Plus — Annual, 3-day trial",
  products: {
    monthly: "pro_999_month",
    annual: "pro_5999_year",
  },
});
```

TypeScript is the only validation, so keep the object literal inline — that's what lets the compiler catch typos. If you want to share settings between paywalls, export a plain object and spread it:

```ts
// superwall/components/shared-config.ts
export const shared = { transition: "slide", purchaseTimeoutMs: 300_000 } as const;

// paywalls/pro/config.ts
export default definePaywall({ ...shared, name: "Pro", products: { … } });
```

## Options

| Key                            | Type                                                    | Default                     | What it does                                                                                            |
| ------------------------------ | ------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------- |
| `name`                         | `string`                                                | directory name, title-cased | The label shown in the dashboard. The directory stays the identifier.                                   |
| `products`                     | `Record<string, string \| { productId }>`               | —                           | Product slots by reference — see [below](#products).                                                    |
| `transition`                   | `"push" \| "slide" \| "fade" \| "none"` or custom       | `"push"`                    | Default page transition — see [Transitions](/docs/framework/transitions).                               |
| `checkout`                     | mode or `{ mode, prefetch? }`                           | —                           | Sell on the web. Omit for native-only — see [Web checkout](/docs/framework/web-checkout).               |
| `presentation`                 | see [below](#presentation)                              | —                           | How the native SDK presents the paywall.                                                                |
| `featureGating`                | `"gated" \| "nonGated"`                                 | `"nonGated"`                | Whether users must pay to pass the placement.                                                           |
| `introductoryOfferEligibility` | `"automatic" \| "alwaysEligible" \| "alwaysIneligible"` | `"automatic"`               | Trial eligibility — `automatic` lets the store decide.                                                  |
| `dismissOnPurchase`            | `boolean`                                               | —                           | Auto-dismiss the paywall after a completed purchase.                                                    |
| `purchaseTimeoutMs`            | `number`                                                | —                           | Resolve a purchase as failed after this long with no result.                                            |
| `notifications`                | `{ trialReminder }`                                     | —                           | Trial-reminder notification — see [below](#trial-reminder-notifications).                               |
| `localization`                 | `{ defaultLocale, messages? }`                          | `"en"`                      | Fallback locale; file-based catalogs need no config — see [Localization](/docs/framework/localization). |
| `scrollEnabled`                | `boolean`                                               | `true`                      | Whether the paywall scrolls.                                                                            |
| `gameControllerEnabled`        | `boolean`                                               | —                           | Forward game-controller input to the paywall.                                                           |
| `onDeviceCacheEnabled`         | `boolean`                                               | `true`                      | Cache the paywall on device.                                                                            |

> **Note:** There is deliberately **no identifier field**. The directory path is the paywall's identity, and the dashboard binding lives in `superwall.lock` — never in this file. See [Project structure](/docs/framework/project-structure).

## Presentation

The `presentation` object controls how the native SDK presents the paywall over your app:

```ts
presentation: {
  style: "fullscreen" | "modal" | "push" | "drawer" | "popup" | "noAnimation",  // default "fullscreen"
  condition: "checkUserSubscription" | "always",                                // default "checkUserSubscription"
  drawer: { height, cornerRadius },          // when style === "drawer"
  popup: { width, height, cornerRadius },    // when style === "popup"
}
```

* **`style`** — `fullscreen` covers the screen, `modal` uses the platform's modal presentation, `push` pushes onto the navigation hierarchy, `drawer` rises from the bottom edge to the height you set, `popup` floats as a centered window, and `noAnimation` presents modally without animating.
* **`condition`** — with the default `checkUserSubscription`, the SDK skips presentation for users who are already subscribed. Use `always` to show the paywall regardless.
* **`drawer` and `popup`** take sizing options that only apply to their matching style.

## Products

Products are **slots**. The key is the reference your code uses; the value is the store identifier:

```ts
products: {
  annual: "pro_5999_year",                    // shorthand
  monthly: { productId: "pro_999_month" },    // same thing
}
```

Your components read them by reference — `getProduct("annual")`, `purchase("annual")` — and the references are typed, so a typo is a compile error. Web/Stripe products put the Stripe price inside the identifier using the `{test|live}:price_…:{offer}` format.

Product **data** — price, period, trial — never appears in this file. It's store-owned and arrives at runtime; a reference the dashboard has no product for renders undefined variables and blocks publishing. The full story, including how to read product variables safely, is in [Products](/docs/framework/products).

## Trial reminder notifications

Declare a local notification and the SDK schedules it when a trial actually starts — the paywall doesn't need to be open when it fires:

```ts
notifications: {
  trialReminder: {
    title: "Your trial ends tomorrow",
    body: "Keep Pro, or cancel in Settings — no charge either way.",
    beforeTrialEndDays: 1,        // default 1
  },
},
```

`title`, `subtitle`, and `body` accept message keys (resolved through `t()`) or literal copy. For full control, pass a function instead — it receives `{ trialEndDate, product, t, locale }` and returns `{ title, body, delayMs }`, or `null` to skip the notification entirely. The trial reminders example shows both forms — see [Examples](/docs/framework/examples).

## Experimenting without rebuilds

Variables are never declared in this file: everything the paywall reads — `useVariables()`, product variables, trial eligibility — is supplied by your app and the store at runtime, and the studio can override all of it live while you preview. Write your paywall to read variables defensively and every one of them becomes experimentable from the dashboard, no rebuild required. See [Variables & personalization](/docs/framework/variables).