# 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

# purchase() / products()

Initiate a standalone purchase and fetch store product details outside of a paywall.

## Purpose

`purchase()` initiates a purchase for a given product identifier without presenting a paywall. `products()` fetches store product details (price, trial info, localized strings) for an array of product identifiers, matching the native `StoreProduct.toJson()` shape on both iOS and Android.

> **Note:** When using a custom `PurchaseController`, calling `purchase()` triggers a double round-trip between JS and native (JS → native → JS → native). The native SDK calls the purchase controller's `purchaseFromAppStore` or `purchaseFromGooglePlay` method, which must then call `didPurchase()` back to the native module. This is an inherent limitation of the bridge architecture.

## Signature

Hook usage:

```ts
const { purchase, products } = useSuperwall()

await purchase(productId: string): Promise<PurchaseResultResponse>
await products(productIds: string[]): Promise<ProductResponse[]>
```

Compat API usage:

```ts
import Superwall from "expo-superwall/compat"

await Superwall.purchase(productId: string): Promise<PurchaseResultResponse>
await Superwall.products(productIds: string[]): Promise<ProductResponse[]>
```

## Parameters

<TypeTable
  type="{
  productId: {
    type: &#x22;string&#x22;,
    description: &#x22;The product identifier to purchase (used by `purchase`).&#x22;,
    required: true,
  },
  productIds: {
    type: &#x22;string[]&#x22;,
    description: &#x22;Product identifiers to fetch details for (used by `products`).&#x22;,
    required: true,
  },
}"
/>

## Returns / State

### PurchaseResultResponse

<TypeTable
  type="{
  type: {
    type: '&#x22;purchased&#x22; | &#x22;cancelled&#x22; | &#x22;pending&#x22; | &#x22;failed&#x22;',
    description: &#x22;Outcome of the purchase attempt.&#x22;,
    required: true,
  },
  error: {
    type: &#x22;string?&#x22;,
    description: &#x22;Error message when `type` is `failed`.&#x22;,
  },
}"
/>

### ProductResponse

<TypeTable
  type="{
  productIdentifier: {
    type: &#x22;string&#x22;,
    description: &#x22;The store product identifier.&#x22;,
    required: true,
  },
  localizedPrice: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized display price for the product.&#x22;,
    required: true,
  },
  localizedSubscriptionPeriod: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized display string for the subscription period.&#x22;,
    required: true,
  },
  period: {
    type: &#x22;string&#x22;,
    description: &#x22;Subscription period unit, such as week or month.&#x22;,
    required: true,
  },
  periodly: {
    type: &#x22;string&#x22;,
    description: &#x22;Subscription period with a `ly` suffix, such as monthly or yearly.&#x22;,
    required: true,
  },
  periodWeeks: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of weeks in the subscription period.&#x22;,
    required: true,
  },
  periodWeeksString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of weeks in the subscription period.&#x22;,
    required: true,
  },
  periodMonths: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of months in the subscription period.&#x22;,
    required: true,
  },
  periodMonthsString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of months in the subscription period.&#x22;,
    required: true,
  },
  periodYears: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of years in the subscription period.&#x22;,
    required: true,
  },
  periodYearsString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of years in the subscription period.&#x22;,
    required: true,
  },
  periodDays: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of days in the subscription period.&#x22;,
    required: true,
  },
  periodDaysString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of days in the subscription period.&#x22;,
    required: true,
  },
  dailyPrice: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized daily price.&#x22;,
    required: true,
  },
  weeklyPrice: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized weekly price.&#x22;,
    required: true,
  },
  monthlyPrice: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized monthly price.&#x22;,
    required: true,
  },
  yearlyPrice: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized yearly price.&#x22;,
    required: true,
  },
  hasFreeTrial: {
    type: &#x22;boolean&#x22;,
    description: &#x22;Whether the product includes a free trial.&#x22;,
    required: true,
  },
  trialPeriodEndDateString: {
    type: &#x22;string&#x22;,
    description: &#x22;Formatted end date of the introductory trial period.&#x22;,
    required: true,
  },
  localizedTrialPeriodPrice: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized introductory price.&#x22;,
    required: true,
  },
  trialPeriodPrice: {
    type: &#x22;number&#x22;,
    description: &#x22;Numeric introductory price.&#x22;,
    required: true,
  },
  trialPeriodDays: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of days in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodDaysString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of days in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodWeeks: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of weeks in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodWeeksString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of weeks in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodMonths: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of months in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodMonthsString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of months in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodYears: {
    type: &#x22;number&#x22;,
    description: &#x22;Number of years in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodYearsString: {
    type: &#x22;string&#x22;,
    description: &#x22;String representation of the number of years in the introductory period.&#x22;,
    required: true,
  },
  trialPeriodText: {
    type: &#x22;string&#x22;,
    description: &#x22;Localized text describing the introductory period.&#x22;,
    required: true,
  },
  locale: {
    type: &#x22;string&#x22;,
    description: &#x22;Locale used for the product's pricing.&#x22;,
    required: true,
  },
  languageCode: {
    type: &#x22;string | null&#x22;,
    description: &#x22;Language code for the product's locale.&#x22;,
  },
  currencyCode: {
    type: &#x22;string | null&#x22;,
    description: &#x22;Currency code for the product's price.&#x22;,
  },
  currencySymbol: {
    type: &#x22;string | null&#x22;,
    description: &#x22;Currency symbol for the product's price.&#x22;,
  },
  regionCode: {
    type: &#x22;string | null&#x22;,
    description: &#x22;Region code for the product's price locale.&#x22;,
  },
  price: {
    type: &#x22;number&#x22;,
    description: &#x22;Numeric price of the product.&#x22;,
    required: true,
  },
  trialPeriodEndDate: {
    type: &#x22;string | null&#x22;,
    description: &#x22;ISO-8601 end date of the introductory trial period.&#x22;,
  },
  isFamilyShareable: {
    type: &#x22;boolean?&#x22;,
    description: &#x22;Whether the product can be shared with family members.&#x22;,
  },
  introOfferToken: {
    type: &#x22;string | null&#x22;,
    description: &#x22;Token for the introductory offer, when available.&#x22;,
  },
  subscriptionGroupIdentifier: {
    type: &#x22;string | null&#x22;,
    description: &#x22;Identifier for the subscription group, when available.&#x22;,
  },
  fullIdentifier: {
    type: &#x22;string?&#x22;,
    description: &#x22;Full store identifier, when available.&#x22;,
  },
  subscriptionPeriod: {
    type: &#x22;{ value: number; unit: string } | null&#x22;,
    description: &#x22;Structured subscription period, when available.&#x22;,
  },
}"
/>

## Usage

```tsx
import { useSuperwall } from "expo-superwall"

function CoinShop() {
  const { purchase, products } = useSuperwall()

  const loadPrices = async () => {
    const items = await products(["coins_100", "coins_500"])
    items.forEach((p) => console.log(p.productIdentifier, p.localizedPrice))
  }

  const buyCoins = async () => {
    const result = await purchase("coins_100")
    if (result.type === "purchased") {
      await grantCoins(100)
    } else if (result.type === "failed") {
      console.error("Purchase failed:", result.error)
    }
  }

  return (
    <>
      <Button title="Load prices" onPress={loadPrices} />
      <Button title="Buy 100 coins" onPress={buyCoins} />
    </>
  )
}
```

## Related

* [`useSuperwall`](/docs/expo/sdk-reference/hooks/useSuperwall) - Hook access to the main Expo SDK store.
* [Consumable Products](/docs/expo/guides/consumable-products) - Set up consumable products for Superwall paywalls.
* [`consume()`](/docs/expo/sdk-reference/hooks/consume) - Consume a Google Play purchase token after granting a consumable benefit.