# 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 Recipes

Ready-made Elements Checkout layouts: wallets and card, Apple Pay with card fields, card first, a one-line card, wallets only, billing address and promo codes.

Each recipe is one way to build the same purchase, and each is a layout in the [`elements-checkout`](https://github.com/superwall/superwall/tree/main/examples/elements-checkout) example, which you can switch between on the page. Every recipe goes inside `<StripeCheckout>` and pays through Superwall, with the same [callbacks](/docs/framework/elements-checkout/events).

```tsx
import { StripeCheckout } from "superwall/checkout/stripe";

<StripeCheckout product={plan} options={options}>
  {/* a recipe */}
</StripeCheckout>;
```

`options` here is the design from [Style Elements Checkout](/docs/framework/elements-checkout/styling). Every element takes all of Stripe's own options; each recipe shows only the ones it needs.

| Recipe                                                  | Stripe pieces                                                                                         | Purchase button    |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------ |
| [Apple Pay, Link and card](#apple-pay-link-and-card)    | Superwall's Apple Pay, `ExpressCheckoutElement` (Link), `LinkAuthenticationElement`, `PaymentElement` | `<PurchaseButton>` |
| [Apple Pay only](#apple-pay-only)                       | Superwall's Apple Pay                                                                                 | None               |
| [Wallets and card](#wallets-and-card)                   | `ExpressCheckoutElement`, `LinkAuthenticationElement`, `PaymentElement`                               | `<PurchaseButton>` |
| [Apple Pay and card fields](#apple-pay-and-card-fields) | `ExpressCheckoutElement` (Apple Pay), the three card fields                                           | Your own           |
| [Card first](#card-first)                               | `LinkAuthenticationElement`, `PaymentElement`, `ExpressCheckoutElement`                               | `<PurchaseButton>` |
| [Card fields](#card-fields)                             | `CardNumberElement`, `CardExpiryElement`, `CardCvcElement`                                            | Your own           |
| [Single card line](#single-card-line)                   | `CardElement`                                                                                         | Your own           |
| [Wallets only](#wallets-only)                           | `ExpressCheckoutElement`                                                                              | None               |
| [With a billing address](#with-a-billing-address)       | `LinkAuthenticationElement`, `AddressElement`, `PaymentElement`                                       | `<PurchaseButton>` |
| [Promo code](#promo-code)                               | `LinkAuthenticationElement`, `PaymentElement`, `useDiscount()`                                        | `<PurchaseButton>` |

The recipes with your own email box use your own button, because `<PurchaseButton>` doesn't show the `email_required` error. See [Your own purchase button](#your-own-purchase-button).

## Apple Pay, Link and card

The layout we recommend for these three. Superwall's own Apple Pay sheet on your button, Link alone in Stripe's express row, and the card form with every wallet off, so no wallet shows twice:

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

const ApplePayButton = ({ product }: { product: string }) => {
  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" })}
    />
  );
};

<ApplePayButton product={plan} />
<ExpressCheckoutElement
  options={{ paymentMethods: { applePay: "never", googlePay: "never", link: "auto" } }}
/>
<LinkAuthenticationElement />
<PaymentElement options={{ layout: "tabs", wallets: { applePay: "never", googlePay: "never" } }} />
<PurchaseButton>Subscribe</PurchaseButton>
```

The Apple Pay sheet's callbacks reach `usePurchase()` only, not `<StripeCheckout>`. See [Elements Checkout Events](/docs/framework/elements-checkout/events). The [step-by-step guide](/docs/framework/elements-checkout#build-an-apple-pay-link-and-card-paywall) builds this one.

## Apple Pay only

Superwall's Apple Pay sheet alone, the same sheet a `checkout: "applePay"` paywall opens. In `elements` mode the paywall prepares it from the form's price. Say why when it isn't ready, since nothing else is on the page:

```tsx
const { product: wallet } = useApplePay(plan);
const { purchase } = usePurchase();

if (wallet.status === "ready") {
  return <button className="apple-pay" onClick={() => void purchase(plan, { checkout: "applePay" })} />;
}
return <p>{wallet.status === "preparing" ? "Getting Apple Pay ready…" : wallet.message}</p>;
```

## Wallets and card

Stripe's express row with every wallet it can show, then the email and the card form:

```tsx
<ExpressCheckoutElement options={{ buttonHeight: 52 }} />
<LinkAuthenticationElement />
<PaymentElement options={{ layout: "tabs" }} />
<PurchaseButton>Subscribe</PurchaseButton>
```

The express row renders nothing on a device with no wallet. To show an "or pay with card" divider only when there's a wallet above it, wait for `onReady`:

```tsx
const [hasWallet, setHasWallet] = React.useState(false);

<ExpressCheckoutElement
  onReady={({ availablePaymentMethods }) =>
    setHasWallet(Object.values(availablePaymentMethods ?? {}).some(Boolean))
  }
/>
{hasWallet ? <p className="divider">or pay with card</p> : null}
```

## Apple Pay and card fields

Only Apple Pay in the express row, above separate card fields. `paymentMethods` turns off every other wallet; where the device has no Apple Pay, the row renders nothing and the card fields stand alone:

```tsx
import {
  CardCvcElement,
  CardExpiryElement,
  CardNumberElement,
  ExpressCheckoutElement,
} from "superwall/checkout/stripe";

<StripeCheckout product={plan} email={email}>
  <ExpressCheckoutElement
    options={{ paymentMethods: { applePay: "auto", googlePay: "never", link: "never" } }}
  />
  <input type="email" value={email} onChange={(event) => setEmail(event.target.value)} />
  <CardNumberElement options={{ style, showIcon: true }} />
  <CardExpiryElement options={{ style }} />
  <CardCvcElement options={{ style }} />
  <PayButton />
</StripeCheckout>;
```

`PayButton` is [your own purchase button](#your-own-purchase-button). This uses Stripe's Apple Pay in the express row; for Superwall's own sheet, use the button from [Apple Pay, Link and card](#apple-pay-link-and-card) instead.

## Card first

The elements are plain components, so put them in any order. Here the card form comes first and the wallets below it:

```tsx
<LinkAuthenticationElement />
<PaymentElement options={{ layout: "accordion", wallets: { applePay: "never", googlePay: "never" } }} />
<p className="divider">or pay with a wallet</p>
<ExpressCheckoutElement options={{ layout: { maxColumns: 2, maxRows: 1 } }} />
<PurchaseButton>Subscribe</PurchaseButton>
```

## Card fields

Stripe's separate card number, expiry and CVC fields, the way many existing checkouts are built, with your own email box passed to `<StripeCheckout email>`:

```tsx
const [email, setEmail] = React.useState("");

<StripeCheckout product={plan} email={email}>
  <input type="email" autoComplete="email" value={email} onChange={(event) => setEmail(event.target.value)} />
  <CardNumberElement className="input" options={{ style, showIcon: true }} />
  <CardExpiryElement className="input" options={{ style }} />
  <CardCvcElement className="input" options={{ style }} />
  <PayButton />
</StripeCheckout>;
```

The card fields pay without `elements.submit()`. If a `PaymentElement` is also mounted, it wins over them. Style them with `options.style`, see [Style the card fields](/docs/framework/elements-checkout/styling#style-the-card-fields).

## Single card line

Stripe's one-line `CardElement`, with your own email box:

```tsx
import { CardElement } from "superwall/checkout/stripe";

<StripeCheckout product={plan} email={email}>
  <input type="email" value={email} onChange={(event) => setEmail(event.target.value)} />
  <CardElement className="input" options={{ style, hidePostalCode: true }} />
  <PayButton />
</StripeCheckout>;
```

## Wallets only

Only the one-tap wallets, with no purchase button. The wallet pays on its own and asks for the email itself:

```tsx
<StripeCheckout product={plan}>
  <ExpressCheckoutElement options={{ buttonHeight: 52 }} />
</StripeCheckout>
```

Closing the wallet reports `onAbandon`.

## With a billing address

Stripe's billing address goes onto the payment method, and `stripeMetadata` onto the subscription:

```tsx
import { AddressElement } from "superwall/checkout/stripe";

<StripeCheckout product={plan} stripeMetadata={{ source: "web-paywall" }}>
  <LinkAuthenticationElement />
  <AddressElement options={{ mode: "billing" }} />
  <PaymentElement options={{ layout: "accordion" }} />
  <PurchaseButton>Subscribe</PurchaseButton>
</StripeCheckout>;
```

`AddressElement` with `mode: "shipping"` isn't supported: a subscription ships nothing.

## Promo code

A code box on `useDiscount()`. A redeemed code re-prices the form: `useCheckout().amounts` and the charge both follow the discounted price.

```tsx
import { useDiscount } from "superwall/hooks";

const PromoCode = () => {
  const { redeem, clear, applied, isRedeeming } = useDiscount();
  const [code, setCode] = React.useState("");
  const [refused, setRefused] = React.useState(false);
  if (applied) {
    return (
      <p>
        {applied.code} applied <button onClick={clear}>Remove</button>
      </p>
    );
  }
  return (
    <form
      onSubmit={async (event) => {
        event.preventDefault();
        setRefused(false);
        const result = await redeem(code);
        if (!result.valid) setRefused(true);
      }}
    >
      <input value={code} onChange={(event) => setCode(event.target.value)} />
      <button disabled={!code.trim() || isRedeeming}>Apply</button>
      {refused ? <p role="alert">That code isn't valid.</p> : null}
    </form>
  );
};
```

Put `<PromoCode />` inside `<StripeCheckout>` next to the card form. A 100% discount makes `amounts.dueNow` `0` with no trial, so check `amounts.trialDays` before you say "free trial". See [Promotion codes](/docs/framework/web-checkout#promotion-codes).

## Your own purchase button

`<PurchaseButton>` shows nothing when the form is incomplete. Build your own on `useCheckout().submit()` to show why, for example when your own email box is empty:

```tsx
import { useCheckout } from "superwall/checkout";

const PayButton = () => {
  const { canSubmit, status, submit } = useCheckout();
  const [problem, setProblem] = React.useState<string>();
  return (
    <>
      {problem ? <p role="alert">{problem}</p> : null}
      <button
        disabled={!canSubmit}
        onClick={async () => {
          setProblem(undefined);
          const result = await submit();
          if (result.status === "incomplete") setProblem(result.error.message || "Check your details.");
        }}
      >
        {status === "paying" ? "Paying…" : "Subscribe"}
      </button>
    </>
  );
};
```

A declined card isn't `incomplete`: it reports `onFailure`, and `useCheckout().failure` holds it. See [`submit()` results](/docs/framework/elements-checkout/reference#submit-results).

## Related

* [Elements Checkout](/docs/framework/elements-checkout): requirements and the full build
* [Elements Checkout Reference](/docs/framework/elements-checkout/reference): every prop, and which elements work
* [Style Elements Checkout](/docs/framework/elements-checkout/styling): the `options` and `style` these recipes use