# 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

# Style Elements Checkout

Make Stripe's elements match your paywall: appearance variables and rules from your design tokens, fonts that load, and styles for the card fields.

Stripe draws its fields in its own frame, so they can't read your paywall's CSS. To make them match, read your design tokens once, resolve each to a plain colour, and hand them to Stripe through `<StripeCheckout options>`. This page builds that, the way the [`elements-checkout`](https://github.com/superwall/superwall/tree/main/examples/elements-checkout) example does in `components/appearance.ts`.

## Requirements

* A paywall with `checkout: "elements"`, see [Elements Checkout](/docs/framework/elements-checkout).
* Design tokens as CSS variables, such as `--surface` and `--fg` in `app/theme.css`.

## Read your tokens as colours

Stripe needs plain colours, not `var(--surface)` or `oklch()`. Resolve each token in the browser and turn it into `rgb()`:

```ts title="components/appearance.ts"
const TOKENS = {
  surface: "--surface",
  raised: "--raised",
  fg: "--fg",
  fgSecondary: "--fg-secondary",
  fgMuted: "--fg-muted",
  border: "--border",
  accent: "--accent",
  danger: "--destructive-ink",
} as const;

type Palette = Record<keyof typeof TOKENS, string>;

const FALLBACK: Palette = {
  surface: "#ffffff",
  raised: "#f5f5f5",
  fg: "#111111",
  fgSecondary: "#555555",
  fgMuted: "#888888",
  border: "rgba(0, 0, 0, 0.12)",
  accent: "#0a7c72",
  danger: "#c62828",
};

const readPalette = (): Palette => {
  if (typeof document === "undefined") return FALLBACK;
  const probe = document.createElement("span");
  probe.style.display = "none";
  document.body.append(probe);
  const canvas = document.createElement("canvas");
  canvas.width = canvas.height = 1;
  const context = canvas.getContext("2d", { willReadFrequently: true });
  if (!context) {
    probe.remove();
    return FALLBACK;
  }
  const palette = {} as Palette;
  for (const [name, variable] of Object.entries(TOKENS) as [keyof Palette, string][]) {
    probe.style.color = `var(${variable})`;
    context.clearRect(0, 0, 1, 1);
    context.fillStyle = getComputedStyle(probe).color;
    context.fillRect(0, 0, 1, 1);
    const [r, g, b, a] = context.getImageData(0, 0, 1, 1).data;
    palette[name] = a === 255 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${(a / 255).toFixed(2)})`;
  }
  probe.remove();
  return palette;
};
```

Read the palette again when the colour scheme changes. The provider switches the root's `light` or `dark` class in its own effect, so wait for the class to change:

```ts
import { useEffect, useState } from "react";
import { useColorScheme } from "superwall/hooks";

const usePalette = (): Palette => {
  const scheme = useColorScheme();
  const [palette, setPalette] = useState<Palette>(readPalette);
  useEffect(() => {
    setPalette(readPalette());
    const observer = new MutationObserver(() => setPalette(readPalette()));
    observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
    return () => observer.disconnect();
  }, [scheme]);
  return palette;
};
```

## Set appearance variables and rules

Give the fields the same surface as your plan rows, so the form looks like part of the paywall. Variables set the colours, font and corners; rules give every field the same border and focus edge as your own inputs:

```ts
import { useMemo } from "react";
import type { StripeCheckoutOptions } from "superwall/checkout/stripe";

export const useStripeOptions = (): StripeCheckoutOptions => {
  const p = usePalette();
  return useMemo(() => {
    const hairline = `1px solid ${p.border}`;
    const flat = { boxShadow: "none" };
    return {
      fonts: FONTS,
      appearance: {
        theme: "flat",
        labels: "above",
        variables: {
          colorPrimary: p.accent,
          colorBackground: p.surface,
          colorText: p.fg,
          colorTextSecondary: p.fgSecondary,
          colorTextPlaceholder: p.fgMuted,
          colorDanger: p.danger,
          fontFamily: "Manrope, system-ui, sans-serif",
          fontSizeBase: "16px",
          borderRadius: "3px",
          focusBoxShadow: "none",
        },
        rules: {
          ".Input": { ...flat, border: hairline, backgroundColor: p.surface, fontSize: "16px" },
          ".Input:focus": { ...flat, borderColor: p.accent },
          ".Input--invalid": { ...flat, borderColor: p.danger },
          ".Tab": { ...flat, border: hairline, backgroundColor: p.surface },
          ".Tab--selected": { ...flat, borderColor: p.accent },
          ".AccordionItem": { ...flat, border: hairline, backgroundColor: p.surface },
          ".Block": { ...flat, border: hairline, backgroundColor: p.surface },
        },
      },
    };
  }, [p]);
};
```

`.Block` is Link's "save my information" box. Stripe lists every variable and class in its [Appearance API](https://docs.stripe.com/elements/appearance-api).

Pass the result to the form:

```tsx
const options = useStripeOptions();

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

> **Keep the options object stable:** Build `options` with `useMemo`. A new object on every render makes Stripe redraw every field, and the shopper loses focus as they type.

## Load your font

Give `fonts` the font file itself, not a stylesheet:

```ts
const MANROPE = "url(https://fonts.gstatic.com/s/manrope/v23/xn7gYHE41ni1AdIRggexSvfedN4.woff2)";
const FONTS = ["400", "500", "600"].map((weight) => ({
  family: "Manrope",
  src: MANROPE,
  weight,
  display: "swap",
}));
```

Stripe fetches a `cssSrc` stylesheet from your paywall's page, and the hosted page's Content Security Policy blocks Google Fonts stylesheets there. A font file loads inside Stripe's own frame instead.

## Style the card fields

`CardElement`, `CardNumberElement`, `CardExpiryElement` and `CardCvcElement` ignore `appearance`. They take `options.style`, and their outer frame is an element of yours, so give it your own input class:

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

const useCardStyle = () => {
  const p = usePalette();
  return useMemo(
    () => ({
      base: {
        color: p.fg,
        iconColor: p.fgMuted,
        fontFamily: "Manrope, system-ui, sans-serif",
        fontSize: "16px",
        "::placeholder": { color: p.fgMuted },
      },
      invalid: { color: p.danger, iconColor: p.danger },
    }),
    [p],
  );
};

const style = useCardStyle();
<CardNumberElement className="input" options={{ style, showIcon: true }} />;
```

The card fields still read their font from `fonts` on `<StripeCheckout options>`.

## Keep fields at 16px

iOS Safari zooms into any focused field with text under 16px. Keep `fontSizeBase`, the `.Input` rule and the card fields' `fontSize` at `16px` or more, and your own inputs too.

## Limitations

* **No CSS reaches inside Stripe's frame.** Only what `appearance`, `fonts` and `style` allow can change.
* **Wallet buttons follow their brand.** `ExpressCheckoutElement` takes `buttonHeight`, `buttonTheme` and `buttonType`, but Apple Pay and Google Pay keep their own look.

## Related

* [Elements Checkout](/docs/framework/elements-checkout): build the form
* [Elements Checkout Reference](/docs/framework/elements-checkout/reference#options): what `options` takes and what Superwall sets
* [Elements Checkout Recipes](/docs/framework/elements-checkout/recipes): layouts built with these styles