# 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

# SuperwallEvent

An enum representing analytical events that are automatically tracked by Superwall.

> **Info:** These events provide comprehensive analytics about user behavior and paywall performance. Use them to track conversion funnels, user engagement, and revenue metrics in your analytics platform.

> **Tip:** Common events to track for conversion analysis include `triggerFire`, `paywallOpen`, `transactionStart`, and `transactionComplete`.

## Purpose

Represents internal analytics events tracked by Superwall and sent to the [`SuperwallDelegate`](/docs/ios/sdk-reference/SuperwallDelegate) for forwarding to your analytics platform.

## Signature

```swift
public enum SuperwallEvent {
  // User lifecycle events
  case firstSeen
  case appOpen
  case appLaunch
  case appClose
  case sessionStart
  case identityAlias
  case appInstall
  
  // Deep linking
  case deepLink(url: URL)
  
  // Paywall events
  case triggerFire(placementName: String, result: TriggerResult)
  case paywallOpen(paywallInfo: PaywallInfo)
  case paywallClose(paywallInfo: PaywallInfo)
  case paywallDecline(paywallInfo: PaywallInfo)
  case paywallPageView(paywallInfo: PaywallInfo, data: PageViewData)
  case paywallWebviewProcessTerminated(paywallInfo: PaywallInfo)
  case paywallPreloadStart(paywallCount: Int)
  case paywallPreloadComplete(paywallCount: Int)
  
  // Transaction events
  case transactionStart(product: StoreProduct, paywallInfo: PaywallInfo)
  case transactionComplete(transaction: StoreTransaction?, product: StoreProduct, type: TransactionType, paywallInfo: PaywallInfo)
  case transactionFail(error: TransactionError, paywallInfo: PaywallInfo)
  case transactionAbandon(product: StoreProduct, paywallInfo: PaywallInfo)
  case transactionRestore(restoreType: RestoreType, paywallInfo: PaywallInfo)
  case transactionTimeout(paywallInfo: PaywallInfo)
  
  // Subscription events
  case subscriptionStart(product: StoreProduct, paywallInfo: PaywallInfo)
  case freeTrialStart(product: StoreProduct, paywallInfo: PaywallInfo)
  case subscriptionStatusDidChange
  
  // System events
  case deviceAttributes(attributes: [String: Any])
  case reviewRequested(count: Int)

  // Permission events (Request permission action)
  case permissionRequested(permissionName: String, paywallIdentifier: String)
  case permissionGranted(permissionName: String, paywallIdentifier: String)
  case permissionDenied(permissionName: String, paywallIdentifier: String)
  
  // And more...
}
```

## Parameters

Each event case contains associated values with relevant information for that event type. Common parameters include:

* `paywallInfo: PaywallInfo` - Information about the paywall
* `data: PageViewData` - Page-level details for `paywallPageView`, including navigation direction and the previous page when available. New in 4.14.2.
* `product: StoreProduct` - The product involved in transactions
* `url: URL` - Deep link URLs
* `attributes: [String: Any]` - Device or user attributes
* `count: Int` - For `reviewRequested`, the number of times a review has been requested (available in version 4.8.1+)
* `permissionName: String` / `paywallIdentifier: String` - The permission requested from the paywall and the identifier of the paywall that triggered it (new in 4.12.0).
* `paywallCount: Int` - Total number of paywalls being preloaded when `paywallPreloadStart`/`paywallPreloadComplete` fire (new in 4.12.0).
* `paywallInfo.presentationId` - A unique identifier shared across events from the same paywall presentation. Available in 4.14.2+ and included in `eventInfo.params` as `presentation_id`.

## Returns / State

This is an enum that represents different event types. Events are received via [`SuperwallDelegate.handleSuperwallEvent(withInfo:)`](/docs/ios/sdk-reference/SuperwallDelegate).

## Usage

These events are received via [`SuperwallDelegate.handleSuperwallEvent(withInfo:)`](/docs/ios/sdk-reference/SuperwallDelegate) for forwarding to your analytics platform.

## Permission events (4.12.0+)

> **Note:** The **Request permission** action for the paywall editor is rolling out and isn't visible in the dashboard yet. Editor support is coming very soon, so you may not see the action in your workspace today.

When you wire the **Request permission** action in the paywall editor, the SDK emits `permission_requested`, `permission_granted`, and `permission_denied` events. Use them to track opt-in funnels or adapt your UI:

```swift
func handleSuperwallEvent(withInfo eventInfo: SuperwallEventInfo) {
  switch eventInfo.event {
  case .permissionRequested(let permission, let paywallId):
    logger.info("Prompting \(permission) from paywall \(paywallId)")
  case .permissionGranted(let permission, _):
    analytics.track("permission_granted", properties: eventInfo.params)
  case .permissionDenied(let permission, _):
    showSettingsNudge(for: permission)
  default:
    break
  }
}
```

See the [Request permissions from paywalls guide](/docs/ios/guides/advanced/request-permissions-from-paywalls) for setup details and Info.plist requirements.

## Paywall preloading events (4.12.0+)

`paywallPreload_start` and `paywallPreload_complete` fire whenever the SDK preloads cached paywalls in the background. Both events include `paywall_count` inside `eventInfo.params`, and the enum cases expose the same value via `paywallCount`. This makes it easy to time or monitor cache warm-up:

```swift
switch eventInfo.event {
case .paywallPreloadStart(let count):
  Metrics.shared.begin("paywall_preload", metadata: ["count": count])
case .paywallPreloadComplete(let count):
  Metrics.shared.end("paywall_preload", metadata: ["count": count])
default:
  break
}
```

Pair these events with the [`shouldPreload`](/docs/ios/sdk-reference/PaywallOptions#properties) option if you want to compare “on-demand” versus background caching strategies.