# 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

# Elements Checkout

Build your own checkout form from Stripe's official elements: Apple Pay, Link and a card form on the paywall, while Superwall takes the payment.

Elements checkout lets a web paywall build its own checkout form from Stripe's official elements: wallet buttons, a card form, a billing address and your own purchase button, laid out and styled however you like. Superwall still does the purchase. It prices the form from the product, takes the payment, runs 3D Secure and the free trial, and completes the purchase with entitlements and redemption, the same way the [sheet and Apple Pay](/docs/framework/web-checkout) do.

It's for web paywalls and [teleport](/docs/framework/teleport) checkout routes that want payment on the page itself, in the paywall's own design, instead of in Superwall's sheet. If you already run a custom Stripe checkout, your elements carry over almost unchanged.

```tsx
import { PurchaseButton } from "superwall/checkout";
import {
  ExpressCheckoutElement,
  LinkAuthenticationElement,
  PaymentElement,
  StripeCheckout,
} from "superwall/checkout/stripe";

<StripeCheckout product="annual" onComplete={...} onFailure={...} onAbandon={...}>
  <ExpressCheckoutElement />
  <LinkAuthenticationElement />
  <PaymentElement />
  <PurchaseButton>Subscribe</PurchaseButton>
</StripeCheckout>
```

Not sure this is the mode you need? See [Apple Pay, Sheet or Elements?](/docs/framework/choosing-checkout-mode).

## Requirements

* **Stripe products.** The form sells Stripe products only, declared as `{environment}:{priceId}:{offer}`, see [Products](/docs/framework/products#web-and-stripe-products). Stripe keys and products are set up in the dashboard, see [Web Checkout](/docs/web-checkout).
* **A host that takes payment in the paywall.** A hosted web paywall, the [Web SDK](/docs/web), or a teleport checkout route, with a public API key. A native SDK must be 4.10.8 or later. See [Where the form can't take payment](#where-the-form-cant-take-payment).
* **Subscriptions.** The form pays for a recurring price, with or without a free trial. A one-time price reports `session_unsupported`.
* **Nothing to install from Stripe.** Every element comes from `superwall/checkout/stripe`. A paywall that never imports it ships none of Stripe's React code.

## Turn it on

Set the paywall's checkout mode to `elements` in `config.ts`:

```ts title="config.ts"
export default definePaywall({
  checkout: { mode: "elements", prefetch: "trial" },
  products: {
    trial: "live:price_1ABC…:7days-free",
    monthly: "live:price_1DEF…:no-trial",
  },
});
```

`prefetch` loads that plan's price as the paywall opens, so the form renders without a wait. `<StripeCheckout>` loads any other plan's price when the shopper picks it. Nothing is created in Stripe until the shopper pays.

A plain `purchase()` on an `elements` paywall still works: it opens Superwall's sheet.

## Build an Apple Pay, Link and card paywall

This is the layout we recommend for Apple Pay, Link and a card, and the default layout of the [`elements-checkout`](https://github.com/superwall/superwall/tree/main/examples/elements-checkout) example:

* Superwall's own Apple Pay sheet on a button of yours. It's the best-instrumented Apple Pay path, the same one `checkout: "applePay"` opens.
* Link on its own in Stripe's express row.
* Stripe's card form with every wallet turned off, so no wallet shows twice, and `<PurchaseButton>` to pay.

Use the full `ExpressCheckoutElement` with every wallet in it only when you want all express methods to appear together.

## Start from the example

```bash
superwall create --example elements-checkout
superwall dev
```Point the identifiers in `config.ts` at Stripe products in your dashboard. Until they match, Studio lists the missing ones and the form reports `unknown_product`.

## Wrap the form in StripeCheckout

`<StripeCheckout>` sells one product. Pass the selected plan; switching plans re-prices the form, and Stripe's fields keep what the shopper typed.```tsx
import { StripeCheckout } from "superwall/checkout/stripe";

const [plan, setPlan] = React.useState<"trial" | "monthly">("trial");

<StripeCheckout product={plan}>
  {/* the form */}
</StripeCheckout>;
```

## Add the Apple Pay button

In `elements` mode the paywall prepares Superwall's Apple Pay wallet from the same price as the form. Show your button when `useApplePay(product)` says it's ready, and open the wallet with `purchase(product, { checkout: "applePay" })`:```tsx
import { useApplePay, usePurchase } from "superwall/hooks";

const ApplePayButton = ({ product }: { product: "trial" | "monthly" }) => {
  const { product: wallet } = useApplePay(product);
  const { purchase } = usePurchase();
  if (wallet.status !== "ready") return null;
  return (
    <button
      type="button"
      className="apple-pay"
      aria-label="Pay with Apple Pay"
      onClick={() => void purchase(product, { checkout: "applePay" })}
    />
  );
};
```Where Apple Pay isn't available, such as in desktop Chrome or on a device with no card in Wallet, the button doesn't render and the card form stands alone. See [Show an Apple Pay button](/docs/framework/web-checkout#show-an-apple-pay-button) for every reason it can be missing.

## Add Link in the express row

`ExpressCheckoutElement` takes Stripe's options. Turn off Apple Pay and Google Pay so only Link shows:```tsx
import { ExpressCheckoutElement } from "superwall/checkout/stripe";

<ExpressCheckoutElement
  options={{
    buttonHeight: 52,
    paymentMethods: { applePay: "never", googlePay: "never", link: "auto" },
  }}
/>
```A shopper who pays with Link here completes the purchase without your purchase button. Closing Link reports `onAbandon`.

## Add the email and card fields

Every purchase needs the shopper's email: it's the Stripe customer's email, for the receipt, the redemption link and the billing portal. `LinkAuthenticationElement` collects it, signs Link shoppers in, and fills itself in when the paywall already knows the user's `email` attribute.```tsx
import { LinkAuthenticationElement, PaymentElement } from "superwall/checkout/stripe";

<LinkAuthenticationElement />
<PaymentElement
  options={{ layout: "tabs", wallets: { applePay: "never", googlePay: "never" } }}
/>
```The wallets are off in `PaymentElement` because the Apple Pay button and the express row already offer them.

## Add the purchase button

`<PurchaseButton>` pays with what the shopper entered. It's disabled until the form can take payment and while it pays, and sets `data-status` so you can style each state:```tsx
import { PurchaseButton, useCheckout } from "superwall/checkout";

const DueToday = () => {
  const { amounts } = useCheckout();
  if (!amounts) return null;
  return <p>Due today: {formatAmount(amounts.dueNow, amounts.currency)}</p>;
};

<DueToday />
<PurchaseButton className="cta">Start free trial</PurchaseButton>
````useCheckout()` works anywhere inside `<StripeCheckout>`. `amounts.dueNow` is `0` during a free trial, and `amounts.trialDays` says how long it is. A 100% discount also makes `dueNow` `0`, so check `trialDays` before you say "free trial". Amounts are in the currency's minor units.Unlike a store purchase, a card payment opens no sheet. Show that it's paying, with a "Paying…" label or a spinner, so the shopper doesn't tap again.

## React to the purchase

`<StripeCheckout>` takes the same callbacks as `usePurchase()`: `onStart`, `onSubmit`, `onComplete`, `onAbandon` and `onFailure`. A declined card keeps the form open and reports `onFailure` with a [failure reason](/docs/framework/payment-failures); `useCheckout().failure` holds it until the next payment starts.```tsx
<StripeCheckout
  product={plan}
  onComplete={() => track("subscribed")}
  onFailure={(failure) => setError(failure.message ?? "Your payment was declined.")}
>
````usePurchase()`'s own callbacks hear this form's purchases too, and the native SDK gets the same `stripe_checkout_*` events as for the sheet.

## Try it with a test card

Push the paywall and open its live URL in a test-mode project: `superwall dev` never takes payment. Then pay with:- `4242 4242 4242 4242`, any future date and CVC: pays.
- `4000 0000 0000 0002`: declined, the form stays open.
- `4000 0025 0000 3155`: asks for 3D Secure.See [Push, promote & publish](/docs/framework/push-and-promote).

## Where the form can't take payment

`useCheckout().status` is `"unavailable"` where the form can't pay, with a `reason` and an English `message` for logs. Render a fallback for it, so nothing on the page looks broken:

| Where                               | `reason`                 | What a purchase does instead                                                                       |
| ----------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------- |
| Inside the iOS app                  | `unsupported_host`       | `purchase()` opens Superwall's hosted checkout, or your [teleport](/docs/framework/teleport) route |
| Studio (`superwall dev`)            | `unsupported_host`       | Studio's purchase prompt                                                                           |
| A native SDK below 4.10.8           | `unsupported_host`       | The hosted checkout page                                                                           |
| A host with no public API key       | `missing_public_api_key` | Nothing to pay with                                                                                |
| `checkout` is `external` or not set | `external_checkout`      | Superwall's hosted checkout                                                                        |

The form is also unavailable for a product it can't sell, such as an App Store product (`unsupported_product`), or when Stripe.js doesn't load (`store_load_failed`). It also reports `session_failed` when fetching the product's price fails, and `session_unsupported` for a price the form can't pay, such as a one-time price or an account on Stripe managed payments.

```tsx
const { status, message } = useCheckout();
if (status === "unavailable") return <p>Payment isn't available here.</p>;
```

## Limitations

* **Cards, wallets and Link only.** Redirect and bank-debit payment methods, such as iDEAL, Klarna, Afterpay, Cash App Pay, SEPA and ACH, aren't supported yet. The form drops them from `paymentMethodTypes` with a console warning, and a payment of any other type fails with `card_not_supported` before anything is charged.
* **No shipping, tax IDs or saved cards.** The form pays as a new customer each time.
* **Not inside the iOS app.** A Stripe purchase in the app always leaves for the browser.
* **Prepaid cards can't be blocked in the form.** `prepaidCards: "block"` applies only to the sheet fallback.
* **Import elements only from `superwall/checkout/stripe`.** Your own copy of `@stripe/react-stripe-js` has its own React context, so its elements throw "Could not find Elements context".

## Related

* [Apple Pay, Sheet or Elements?](/docs/framework/choosing-checkout-mode): which checkout mode to use
* [Web Checkout](/docs/framework/web-checkout): modes, prefetch, promotion codes and metadata
* [Payment failure reasons](/docs/framework/payment-failures): what `onFailure` receives
* [`elements-checkout` example](https://github.com/superwall/superwall/tree/main/examples/elements-checkout): every layout, with a live event log