Events
Reference for custom store events: the endpoint, every event type and field, how retries, ordering and refunds work, and how sandbox and production revenue are counted.
Your server reports every change in your billing system to Superwall as an event. Each accepted event updates the user's entitlements, is delivered to your webhooks and integrations, and counts toward revenue charts.
Send events
curl -X POST https://api.superwall.com/v2/custom-stores/$CUSTOM_STORE_ID/events \
-H "Authorization: Bearer $SUPERWALL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
{
"event_id": "evt_01J9Y6Q3W0V7",
"type": "initial_purchase",
"app_user_id": "user_8812",
"product_id": "pro_monthly",
"subscription_id": "sub_4f1c",
"transaction_id": "inv_9a77",
"custom_transaction_id": "9f2c1d3e-4b5a-4c6d-8e7f-0a1b2c3d4e5f",
"environment": "production",
"occurred_at": "2026-12-01T09:15:02Z",
"purchased_at": "2026-12-01T09:15:00Z",
"expires_at": "2027-01-01T09:15:00Z",
"period_type": "normal",
"price": { "amount": "9.99", "currency": "USD" }
}
]
}'- The API key needs the
custom_store_events:writescope. - Send 1 to 100 events per request.
- An unknown or misspelled field anywhere in the body fails the whole request with
400.
The full schema is at api.superwall.com/docs under Custom Store Events.
Event types
| Type | When to send it | Effect on access | price |
|---|---|---|---|
initial_purchase | A subscription starts, including a free trial. | Granted until expires_at | Required. "0" for a free trial. |
renewal | A new paid period starts. Also a plan change that charges the customer. | Extended to expires_at | Required |
product_change | The subscription moves to another product without a charge. product_id is the new product. | Unchanged | Not allowed |
cancellation | Auto-renew is turned off. | Continues until expires_at | Not allowed |
uncancellation | Auto-renew is turned back on before expiry. | Unchanged | Not allowed |
billing_issue | A renewal payment failed and is being retried. | Continues until expires_at | Not allowed |
expiration | The subscription ended. | Ends | Not allowed |
refund | The current period was refunded in full. | Ends at once, for good | Required: the refunded amount |
non_renewing_purchase | A one-time purchase. | Granted until expires_at, or for life with expires_at: null | Required |
Event fields
| Field | Required | Description |
|---|---|---|
event_id | Yes | Your unique ID for this event: 1 to 128 letters, digits, _, -, . or :. Superwall never applies the same event_id twice. Derive it from your billing system's event ID. |
type | Yes | One of the event types. |
app_user_id | Yes | The user who owns the subscription: the ID your app passes to Superwall.shared.identify(userId:), or the app_user_id from the checkout request. No leading or trailing whitespace. |
product_id | Yes | The product's identifier, exactly as you created it on the custom store. |
subscription_id | Yes | Your stable ID for the subscription, the same on every renewal. For a non_renewing_purchase, the purchase's ID. |
transaction_id | Yes | Your ID for this period's charge or invoice. |
environment | Yes | production, or sandbox for test purchases. |
occurred_at | Yes | When the change happened in your billing system. Decides which event is newest. |
purchased_at | Yes | Start of the current period. |
expires_at | Yes | End of the current period. null is allowed only on a lifetime non_renewing_purchase, an expiration and a refund. |
period_type | Yes | trial for a free trial, intro for an introductory price, otherwise normal. |
price | By type | What the customer paid for this period. See price. |
custom_transaction_id | No | Links the subscription's revenue to the paywall that sold it. See paywall attribution. |
cancel_reason | No | On cancellation, expiration and refund only: unsubscribe, billing_error, developer_initiated, price_increase, customer_support or unknown. |
is_trial_conversion | No | true on the renewal that turns a free trial into a paid period. |
Timestamps are ISO 8601 with a time zone, such as 2026-12-01T09:15:02Z. occurred_at and purchased_at can't be more than five minutes ahead of Superwall's clock, and expires_at can't be before purchased_at.
Price
{ "amount": "9.99", "currency": "USD" }amountis a decimal string in major units:"9.99", not999. It allows up to 9 digits before the point and 6 after.currencyis an uppercase ISO 4217 code. Superwall converts the amount to USD at the exchange rate when the event arrives.- Report what the customer paid, after discounts and before tax.
- On a
refund, send the refunded amount as a positive number.
The response
A 200 has one result per event, in the order you sent them:
{
"object": "custom_store_event_batch",
"custom_store_id": "4821",
"accepted": 1,
"rejected": 1,
"results": [
{ "event_id": "evt_01J9Y6Q3W0V7", "status": "accepted" },
{
"event_id": "evt_01J9Y6Q3W0V8",
"status": "rejected",
"error": {
"code": "unknown_product",
"message": "...",
"param": "events[1].product_id"
}
}
]
}A 200 doesn't mean every event was recorded. Check each result's status.
Rejected events
A rejection is always a problem with that event. Fix it before you send it again.
| Code | Meaning |
|---|---|
unknown_product | No product on this store has that product_id. |
product_archived | A new purchase names an archived product. Renewals and other events for existing subscribers still work. |
price_required | The event type needs a price. |
price_not_applicable | The event type doesn't take a price. |
expires_at_required | expires_at is null on a type that needs a date. |
expires_before_purchase | expires_at is before purchased_at. |
occurred_at_in_future, purchased_at_in_future | The timestamp is more than five minutes ahead. |
cancel_reason_not_applicable | The event type doesn't take a cancel_reason. |
unsupported_currency | Superwall has no exchange rate for the currency. |
invalid_app_user_id | app_user_id is a placeholder such as null or undefined. |
duplicate_event_id | The same event_id appears twice in one request. |
Request errors
| Status | Meaning | What to do |
|---|---|---|
400 | The body is malformed: an unknown field, an unknown type, a bad timestamp, or an amount that isn't a decimal string. | Fix the request. |
401, 403 | The key is missing, wrong, or lacks the custom_store_events:write scope. | Fix the key, then send again. |
404 | The key can't see a custom store with that ID. | Check the store ID and the key's project. |
409 | The store is fed by RevenueCat Billing, which reports its subscriptions. | Don't send events to this store. |
429 | Rate limited, per custom store. | Wait for Retry-After, then send again. |
500, 503, or a timeout | Nothing was recorded. | Send the same batch again, unchanged. |
Superwall answers within 20 seconds.
Rules
Retries are safe
event_id is an idempotency key, scoped to the store. When a request fails or times out, send the same batch again with the same body.
Never send an event_id again with a different body. It isn't refused, but analytics may keep either version and can count it twice. To correct a mistake, send a new event.
Order doesn't matter
Events can arrive in any order. Superwall orders them by occurred_at, so a late renewal never overwrites a newer cancellation. This only works if occurred_at is when the change happened, not when you sent the request.
A refund is final
A refund ends the subscription at once, and no later event restores that subscription_id.
- Cancel the subscription in your billing system too, so the customer isn't billed again.
- A customer who subscribes again needs a new
subscription_id. - Partial refunds aren't supported. Don't report them.
Access ends at expires_at
Superwall has no grace period for custom stores. When expires_at passes without a renewal, access ends, even during a billing_issue. If you give customers extra time while a payment retries, send that later date as expires_at.
One reporter per subscription
Report only purchases that no other integration reports. A subscription that the App Store, Google Play, Stripe or RevenueCat integration also reports counts its revenue twice.
Sandbox and production
Send test purchases with environment: "sandbox". They grant access like production events. Revenue charts show them only when you filter to the Sandbox environment.
The store's first accepted production event sets its reporting_since to the time that request arrived. From then on, revenue charts count this store's purchases from your server's events only, and ignore what the SDK reported about them, so nothing is counted twice.
If you later send events from before that time, such as a backfill of existing subscribers, move reporting_since back to the start of the backfill. Click Edit next to the store's status in the dashboard, or use the API:
curl -X PATCH https://api.superwall.com/v2/projects/$PROJECT_ID/custom-stores/$CUSTOM_STORE_ID \
-H "Authorization: Bearer $SUPERWALL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"reporting_since": "2026-06-01T00:00:00Z"}'Once reporting_since is set, it can be moved but not cleared, and the store can't be deleted. This keeps its revenue history intact.
Paywall attribution
custom_transaction_id credits a subscription's revenue, renewals included, to the paywall, campaign and experiment that sold it. Without it, the revenue still counts but isn't attributed to a paywall.
Where the value comes from:
- With a checkout endpoint, Superwall sends it in the
checkout.createrequest. - With a
PurchaseController, readStoreProduct.customTransactionIdfrom the product the SDK passes to your purchase method. It's available in the iOS SDK 4.19.0 and later and the Android SDK 2.8.0 and later.
Store it in your checkout's metadata, and send it back on the initial_purchase or non_renewing_purchase. Once is enough, within 14 days of the purchase on the paywall. With a checkout endpoint, the paywall also waits for this value before it closes as purchased.
How is this guide?
Checkout Endpoint
Reference for a custom store's checkout endpoint: the signed checkout.create request Superwall sends, how to verify it, what to answer, and how the customer returns to your app.
Paddle
Sell Paddle Billing subscriptions on Superwall paywalls with a custom store: Paddle runs the checkout, and Superwall grants access and reports the revenue.