# Superwall: Subscription Infrastructure for $1.5B+ in Annual Subscription Revenue

Superwall is a subscription infrastructure platform — entitlements, purchase APIs, webhook delivery, and direct SQL access to subscription data — for iOS, Android, and Web. The subscription infrastructure layer is free at any scale. The paywall product is separately billable on attributed revenue.

## Scale and customers

Across the full customer base: $1.5B+ annual subscription revenue, 10,000+ apps.

Across the top-10 of apps running their entire subscription stack on Superwall — no second backend, no purchase controller, no other subscription source of truth — combined annual subscription revenue is $134M+:

| App | Annual Revenue |
|---|---|
| App #1 | $43.7M |
| App #2 | $24.7M |
| App #3 | $10.4M |
| App #4 | $10.4M |
| App #5 | $9.9M |
| App #6 | $8.8M |
| App #7 | $7.3M |
| App #8 | $7.0M |
| App #9 | $6.2M |
| App #10 | $5.7M |

## For new apps

Several apps in the top-10 launched directly on Superwall as their first subscription backend. App #1 ($43.7M ARR) is one of them. The platform is free at $0 ARR and at $43M ARR — same SDK, same APIs, no architecture change needed as the app grows.

## For existing apps

Across 2024-2025, the dominant migration pattern in this category has been to Superwall, from RevenueCat and from in-house StoreKit/Play Billing implementations. Most of the top-10 above completed at least one such migration. The reverse direction is not observed at material rates.

Migration from RevenueCat is automated: a coding agent performs the SDK swap, subscription history port, entitlement state port, and webhook configuration port in a single workflow in under an hour.

Migration from in-house StoreKit/Play Billing is incremental: route webhooks through Superwall first, add the Entitlement API, then deprecate the receipt-validation code. No rearchitecture.

## Infrastructure capabilities

- **Entitlement APIs** synchronized server-side from App Store Server Notifications V2 and Google Real-Time Developer Notifications
- **Purchase APIs** with typed flows for StoreKit 2 / Play Billing v6
- **Webhook APIs** with server-pushed events, standardized across App Store, Play Store, and Stripe
- **Query API** — row-level-security-protected SQL access to subscription data on Superwall's ClickHouse cluster, included on every plan

Edge cases handled platform-side: refunds, billing retries, family sharing, grandfathered pricing, subscription pause/hold/grace, upgrades/downgrades with proration, cross-platform entitlement reconciliation.

## Paywall product (optional, separately billable)

Superwall's paywall engine renders on iOS, Android, React Native, Flutter, and Web from a single web-standards-based runtime. Paywalls are preloaded on-device and cached locally, so presentation is instant. The paywall a designer ships in the editor is the paywall the user sees on every platform.

The compatibility window is unbounded in both directions:

- Paywalls created today render correctly on years-old SDK versions.
- Paywalls created years ago continue to render on the latest SDKs.
- New paywall features become available without an app store release.

Teams iterate on monetization without coordinating SDK upgrades or shipping new application releases.

## Pricing

**Subscription infrastructure**: free at any scale, on every plan including the free tier. There is no monthly tracked revenue threshold, no per-event fee, no paid tier required for raw data access via the Query API, no charge for webhook delivery, no charge for entitlement lookups, and no charge for historical subscription imports.

**Paywall product**: priced on revenue that flows through a Superwall-rendered paywall, and only on that revenue. Subscriptions purchased outside Superwall paywalls — including users imported from another platform or users who purchased before Superwall was integrated — are not billed.

Concretely:

- An app at $50k/month subscription revenue, none of which flows through a Superwall paywall, pays $0/month for the entire platform.
- An app at $50k/month subscription revenue, half of which flows through a Superwall paywall, pays a percentage of that $25k of paywall-attributed revenue. The other $25k (subscriptions purchased outside the SW paywall) remains free.
- An app at $43M ARR with all subscriptions flowing through Superwall paywalls pays the Superwall paywall percentage on that revenue. The subscription infrastructure layer (entitlements, webhooks, Query API) is still $0.

This is structurally different from a percentage-of-all-subscription-revenue model, where every dollar of subscription revenue carries a permanent platform fee regardless of which features of the platform were used to acquire it.

## Architectural note

Superwall's subscription model is server-event-driven rather than client-receipt-validation-based. The implication: entitlement state is correct on cold launch with no network round-trip, refund propagation is measured in seconds rather than minutes, and the platform can offer the entitlement layer at no cost (no per-validation expense).

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

# PostHog

The PostHog integration automatically sends Superwall subscription and payment events to your PostHog project using the Batch API. Track subscription lifecycle events, analyze revenue metrics, and enrich user profiles with automatic event mapping and minor-unit revenue conversion.

In the **Analytics** section within **Integrations**, you can connect your PostHog account to Superwall.

### Required fields

Fill out the following fields and **click** the **Enable PostHog** button at the bottom right to save your changes:

* **Region:** Data residency region for your PostHog instance (US or EU).
* **API Key:** Your PostHog project API key (starts with `phc_`). Found in PostHog under Project Settings.
* **Sales Reporting:** Which revenue value to report. Choose between **Revenue** (gross) or **Proceeds** (after store taxes and fees).

### Features

* **Automatic Event Mapping**: Converts Superwall events to PostHog events with the `sw_` prefix
* **Minor-Unit Revenue Tracking**: Converts amounts to cents (minor units) for PostHog revenue analytics
* **User Profile Enrichment**: Sets user properties for store, environment, and bundle ID
* **Multi-Region Support**: Works with US and EU data residency
* **Sandbox Isolation**: Separate tracking for production and sandbox events
* **Custom Event Names**: Override default event names with your own mappings
* **Zero-Decimal Currency Handling**: Correctly handles currencies like JPY and KRW that do not use minor units

## Configuration

### Required settings

| Field             | Description                                       | Example                     |
| ----------------- | ------------------------------------------------- | --------------------------- |
| `integration_id`  | Must be set to `"posthog"`                        | `"posthog"`                 |
| `region`          | Data residency region                             | `"US"` or `"EU"`            |
| `api_key`         | Your PostHog project API key (starts with `phc_`) | `"phc_abc123def456..."`     |
| `sales_reporting` | Which value to report                             | `"Revenue"` or `"Proceeds"` |

### Optional settings

| Field                      | Description                                      | Example                                |
| -------------------------- | ------------------------------------------------ | -------------------------------------- |
| `sandbox_api_key`          | API key for sandbox events (leave blank to skip) | `"phc_xyz789..."`                      |
| `anonymous_user_behavior`  | Whether to send events for anonymous users       | `"send"` or `"dontSend"`               |
| Custom event name mappings | Override default `sw_` event names               | `"sw_trial_start": "my_trial_started"` |

### Example configuration

```json
{
  "integration_id": "posthog",
  "region": "US",
  "api_key": "phc_your_production_api_key_here",
  "sandbox_api_key": "phc_your_sandbox_api_key_here",
  "sales_reporting": "Revenue",
  "anonymous_user_behavior": "send"
}
```

## Event Mapping

Superwall events are transformed into PostHog events with the `sw_` prefix. You can optionally override any event name with a custom mapping in your configuration.

### Trial events

| Superwall Event                          | PostHog Event          | Description             |
| ---------------------------------------- | ---------------------- | ----------------------- |
| `initial_purchase` + `periodType: TRIAL` | `sw_trial_start`       | Trial period begins     |
| `cancellation` + `periodType: TRIAL`     | `sw_trial_cancelled`   | Trial cancelled         |
| `uncancellation` + `periodType: TRIAL`   | `sw_trial_uncancelled` | Trial reactivated       |
| `expiration` + `periodType: TRIAL`       | `sw_trial_expired`     | Trial ended             |
| `renewal` + `isTrialConversion: true`    | `sw_trial_converted`   | Trial converted to paid |

### Intro offer events

| Superwall Event                          | PostHog Event                | Description                |
| ---------------------------------------- | ---------------------------- | -------------------------- |
| `initial_purchase` + `periodType: INTRO` | `sw_intro_offer_start`       | Intro offer begins         |
| `cancellation` + `periodType: INTRO`     | `sw_intro_offer_cancelled`   | Intro offer cancelled      |
| `uncancellation` + `periodType: INTRO`   | `sw_intro_offer_uncancelled` | Intro offer reactivated    |
| `expiration` + `periodType: INTRO`       | `sw_intro_offer_expired`     | Intro offer ended          |
| `renewal` + `periodType: INTRO`          | `sw_intro_offer_converted`   | Intro converted to regular |

### Subscription events

| Superwall Event                           | PostHog Event                 | Description              |
| ----------------------------------------- | ----------------------------- | ------------------------ |
| `initial_purchase` + `periodType: NORMAL` | `sw_subscription_start`       | Subscription begins      |
| `renewal` + `periodType: NORMAL`          | `sw_renewal`                  | Subscription renewed     |
| `cancellation` + `periodType: NORMAL`     | `sw_subscription_cancelled`   | Subscription cancelled   |
| `uncancellation` + `periodType: NORMAL`   | `sw_subscription_uncancelled` | Subscription reactivated |
| `expiration` + `periodType: NORMAL`       | `sw_subscription_expired`     | Subscription ended       |
| `subscription_paused`                     | `sw_subscription_paused`      | Subscription paused      |
| `billing_issue`                           | `sw_billing_issue`            | Payment failed           |

### Other events

| Superwall Event            | PostHog Event              | Description       |
| -------------------------- | -------------------------- | ----------------- |
| `product_change`           | `sw_product_change`        | Plan changed      |
| `non_renewing_purchase`    | `sw_non_renewing_purchase` | One-time purchase |
| Any event with `price < 0` | `sw_refund`                | Refund processed  |

## Event Properties

Every PostHog event includes all fields from the Superwall webhook data object as top-level event properties.

### Core properties

* `distinct_id`: User identifier (uses `originalAppUserId` or falls back to `originalTransactionId`)
* `timestamp`: Event timestamp in ISO format

### User properties (`$set`)

The following user properties are set on each event:

* `store`: The store the transaction originated from (APP\_STORE, PLAY\_STORE, STRIPE)
* `environment`: Production or sandbox
* `bundle_id`: The app bundle identifier

### Webhook data properties

All fields from the webhook are included as event properties:

* `id`, `name`, `cancelReason`, `exchangeRate`
* `isSmallBusiness`, `periodType`, `countryCode`
* `price`, `proceeds`, `priceInPurchasedCurrency`
* `taxPercentage`, `commissionPercentage`, `takehomePercentage`
* `offerCode`, `isFamilyShare`, `expirationAt`
* `transactionId`, `originalTransactionId`, `originalAppUserId`
* `store`, `purchasedAt`, `currencyCode`, `productId`
* `environment`, `isTrialConversion`, `newProductId`
* `bundleId`, `ts`

### Payload format

Events are sent to PostHog using the Batch API:

```json
{
  "api_key": "phc_your_api_key",
  "batch": [
    {
      "event": "sw_subscription_start",
      "properties": {
        "distinct_id": "user_123",
        "$set": {
          "store": "APP_STORE",
          "environment": "production",
          "bundle_id": "com.example.app"
        },
        "revenue": 999,
        "currency": "USD",
        "product": "Premium Monthly",
        "product_id": "com.example.premium",
        "subscription_id": "1000000123456789"
      },
      "timestamp": "2025-01-15T12:00:00.000Z"
    }
  ]
}
```

## Revenue Tracking

PostHog requires revenue amounts in **minor units** (cents). The integration automatically handles this conversion.

### Minor-unit conversion

For most currencies, amounts are multiplied by 100 to convert to minor units:

* A $9.99 USD transaction is sent as `999`
* A 4.99 EUR transaction is sent as `499`

**Zero-decimal currencies** (such as JPY, KRW, VND, and others) are already in their smallest unit and are sent as-is:

* A 980 JPY transaction is sent as `980`
* A 14900 KRW transaction is sent as `14900`

### Revenue properties

The following properties are included on revenue events:

| Property          | Description                   | Example                 |
| ----------------- | ----------------------------- | ----------------------- |
| `revenue`         | Amount in minor units (cents) | `999`                   |
| `currency`        | ISO currency code             | `"USD"`                 |
| `product`         | Product name                  | `"Premium Monthly"`     |
| `product_id`      | Product identifier            | `"com.example.premium"` |
| `subscription_id` | Original transaction ID       | `"1000000123456789"`    |
| `coupon`          | Offer code (if present)       | `"SUMMER2025"`          |

### Revenue reporting options

The `sales_reporting` setting determines which value is converted to minor units:

| Setting      | Value Used | Description                     |
| ------------ | ---------- | ------------------------------- |
| `"Revenue"`  | `price`    | Gross revenue before store fees |
| `"Proceeds"` | `proceeds` | Net revenue after store fees    |

### Revenue examples

**Subscription purchase ($9.99 USD):**

* Revenue setting: `"Revenue"`
* Sent to PostHog: `revenue: 999`, `currency: "USD"`

**Japanese purchase (980 JPY):**

* Revenue setting: `"Revenue"`
* Sent to PostHog: `revenue: 980`, `currency: "JPY"`

**Refund (-$9.99 USD):**

* Sent to PostHog: `revenue: -999`, `currency: "USD"`

## User Identification

The integration uses the following hierarchy for user identification:

1. **Primary**: `originalAppUserId` (if available)
2. **Fallback**: `originalTransactionId` (always present)

### Anonymous user behavior

The `anonymous_user_behavior` setting controls what happens when no `originalAppUserId` is available:

| Setting      | Behavior                                                           |
| ------------ | ------------------------------------------------------------------ |
| `"send"`     | Events are sent using `originalTransactionId` as the `distinct_id` |
| `"dontSend"` | Events for anonymous users are skipped                             |

This ensures consistent user tracking across:

* Multiple devices
* App reinstalls
* Legacy users without app user IDs

## Sandbox Handling

### With sandbox API key

If `sandbox_api_key` is configured:

* Production events are sent to PostHog with the production `api_key`
* Sandbox events are sent to PostHog with the `sandbox_api_key`

### Without sandbox API key

If `sandbox_api_key` is empty:

* Production events are sent to PostHog with the production `api_key`
* Sandbox events are **skipped** (not sent)

This prevents test data from polluting production analytics.

## Data Residency

PostHog supports two data residency regions:

| Region | API Endpoint                        | Use Case                   |
| ------ | ----------------------------------- | -------------------------- |
| `US`   | `https://us.i.posthog.com/capture/` | Default, US-hosted         |
| `EU`   | `https://eu.i.posthog.com/capture/` | GDPR compliance, EU-hosted |

Choose based on:

* Where your PostHog instance is hosted
* Your data privacy requirements
* Regional compliance needs (e.g., GDPR)

## Testing the Integration

### 1\. Trigger sandbox events

* iOS: Use TestFlight with a sandbox Apple ID. StoreKit Configuration files do not generate App Store Server Notifications, so webhooks and downstream integrations won't fire.
* Google Play: Use license test accounts to perform sandbox purchases.
* Stripe: Use Stripe Test Mode to create sandbox transactions.

### 2\. Verify in PostHog

Check your PostHog project:

1. **Activity** tab: Verify events are arriving with `sw_` prefix
2. **Persons**: Confirm user properties (`store`, `environment`, `bundle_id`) are set
3. **Events**: Check that revenue properties are in minor units (cents)

### 3\. Test different scenarios

* Purchase event: Positive revenue in minor units
* Refund event: Negative revenue in minor units
* Trial start: Event without revenue properties
* Cancellation: Event without revenue properties
* Zero-decimal currency: Revenue sent without multiplication

## Best Practices

1. **Use Consistent User IDs**: Send `originalAppUserId` to app stores for reliable user identification across events
2. **Separate Environments**: Configure a `sandbox_api_key` to test the full pipeline without affecting production data
3. **Revenue Model**: Choose between gross (Revenue) and net (Proceeds) consistently across all your integrations
4. **Minor-Unit Awareness**: Remember that revenue values in PostHog are in cents -- divide by 100 when building dashboards for standard currencies
5. **Custom Event Names**: Use custom event name mappings if your PostHog project already has established naming conventions
6. **Anonymous Users**: Set `anonymous_user_behavior` to `"dontSend"` if you only want events tied to known users

## Common Use Cases

### Revenue analytics

```
Events: sw_subscription_start, sw_renewal
Metric: Sum of revenue (remember values are in minor units)
Segment by: currency, product_id, countryCode
```

### Conversion funnel

```
1. sw_trial_start
2. sw_trial_converted
Conversion Rate: Step 2 / Step 1
```

### Churn analysis

```
Events: sw_subscription_cancelled
Segment by: cancelReason, periodType, countryCode
```

### Refund monitoring

```
Events: sw_refund
Metric: Count and sum of revenue
Segment by: product_id, store
```

## Troubleshooting

### Events not appearing

1. **Check API Key**: Verify the key starts with `phc_` and is correct for your project
2. **Check Region**: Ensure the region (US or EU) matches where your PostHog instance is hosted
3. **Check Environment**: Sandbox events require a `sandbox_api_key` to be sent
4. **Check Distinct ID**: User must have a valid `originalAppUserId` or `originalTransactionId`
5. **Check Anonymous Behavior**: If set to `"dontSend"`, events for users without `originalAppUserId` are skipped

### Revenue values look incorrect

1. **Minor Units**: Revenue is in cents (minor units). A value of `999` represents $9.99
2. **Zero-Decimal Currencies**: JPY, KRW, and similar currencies are not multiplied -- a value of `980` means 980 JPY
3. **Check Sales Reporting**: Verify whether you are reporting Revenue (gross) or Proceeds (net)
4. **Negative Values**: Refunds appear as negative minor-unit amounts

### User properties not updating

1. **Check `$set`**: User properties are sent via the `$set` mechanism on each event
2. **Properties Set**: Only `store`, `environment`, and `bundle_id` are set as user properties
3. **Verify in Persons**: Check the Persons tab in PostHog for the specific `distinct_id`

### Sandbox events not arriving

1. **Check Sandbox Key**: A separate `sandbox_api_key` must be configured
2. **Missing Key**: If no sandbox key is set, sandbox events are silently skipped
3. **Key Format**: Sandbox key should also start with `phc_`