RevenueCat
Integrate RevenueCat for subscription management and entitlements.
Connect RevenueCat to sync subscription status and entitlements with Amba. When a user subscribes via RevenueCat, their entitlements are automatically updated in Amba.
The same integration also powers the Monetization Control Plane — declare your entitlements, products, and offerings as code and plan / apply them to RevenueCat (quickstart).
RevenueCat handles App Store and Play Store subscriptions. For web checkout, follow RevenueCat's documented Stripe Billing path with the built-in Web Subscriptions integration — web purchases grant the same entitlements through the same cascade. For everything else — manual support grants, gift codes, ToS-violation revokes, migrations from legacy systems — use
POST /admin/projects/:projectId/users/:userId/entitlementsto grant the same entitlement directly. All paths produce the same entitlement and are read through the same client API.
Setup
1. Configure the integration
Via MCP:
Via Admin API:
secret_api_key is RevenueCat's secret REST API key (api_key is still
accepted on older rows). To use the
Monetization Control Plane's apply, also supply a
read-write key (project_configuration:*:read_write) as
secret_api_key_write — or use one full-access key for both. Keys are
resolved server-side and never returned to a client.
2. Set up the webhook
The API returns a webhook URL when you configure the integration:
Add this URL in your RevenueCat dashboard under Project Settings > Integrations > Webhooks, and set the webhook's Authorization header value to Bearer <webhook_secret> — the literal word Bearer, a space, then the same webhook_secret you configured above. Amba compares the full header value on every delivery (constant-time) and rejects deliveries that do not match.
3. Webhook events
Amba processes these RevenueCat webhook events:
| Event | Action |
|---|---|
INITIAL_PURCHASE | Grants entitlements; fires the reward cascade |
RENEWAL | Grants/extends entitlements; fires the reward cascade |
NON_RENEWING_PURCHASE | Grants entitlements; fires the reward cascade |
PRODUCT_CHANGE | Grants entitlements for the new product |
UNCANCELLATION | Re-grants entitlements |
CANCELLATION | Keeps access until the paid period ends (auto-renew off ≠ revoke) |
EXPIRATION | Deactivates entitlements |
REFUND | Deactivates entitlements |
SUBSCRIPTION_PAUSED | Deactivates entitlements |
Other event types that carry entitlement IDs are treated conservatively as
grants. Every fresh event also updates the neutral subscription_* user
properties (subscription_active, subscription_last_event,
subscription_product_id, subscription_store), dedupes on RevenueCat's
event ID, and carries an ordering watermark so a delayed EXPIRATION cannot
clobber a newer RENEWAL.
Deliveries are authenticated by comparing the Authorization header against
Bearer <webhook_secret> in constant time.
4. Identify the user
Configure the RevenueCat SDK with an id Amba can map back to an app user. Two conventions are supported:
- Anonymous-first apps (no sign-up): use the Amba app user id —
Amba.appUserIdaftersignInAnonymously(), or theidreturned byAmba.auth.me(). It is stable per install and survives restarts, so purchases stay attached to the same user.Amba.entitlements.restore()sends this same id when no external id is set. - Apps with their own user id: store it as the user's
external_idand give RevenueCat the same value.
Each webhook event's app_user_id is resolved in this order: a customer id
already recorded on one of the user's entitlements, then external_id, then
the Amba app user id when the value is UUID-shaped. external_id stays ahead
of the app user id, so an app keyed on external ids keeps resolving to that
user even for UUID-shaped values. An event whose id matches none of these
fails processing after delivery has already been acknowledged, so pick one
convention before the first purchase. If RevenueCat was configured anonymously
on the device before the Amba id was available, call the RevenueCat SDK's
logIn with the chosen id so later events carry it.
Admin API reference
| Method | Path | Description |
|---|---|---|
POST | /admin/integrations | Configure integration |
GET | /admin/integrations | List active integrations |
PATCH | /admin/integrations/revenuecat | Update config |
POST | /admin/integrations/revenuecat/test | Test connection |