Skip to content

Legacy RevenueCat

Sync mobile app-store entitlements from RevenueCat into BillStack.

Legacy (v1) API. This page describes the Stripe-first legacy API. It stays supported for existing integrations but is frozen: new features ship only in v2. Prefer v2 for new work: Multi-provider v2.

This page documents the legacy v1 RevenueCat integration, including its project-level provider configuration and project webhook. v2 uses team-scoped provider connections, project-scoped bindings, regions (a provider connection plus the countries it serves), and explicit country confirmation with no silent provider fallback. RevenueCat is an entitlement source, not a payment provider, so it never forms a region. See Multi-provider v2.

RevenueCat is an entitlement-only provider. BillStack does not start checkout through RevenueCat — purchases happen in the App Store, Play Store, or a RevenueCat-hosted paywall, and RevenueCat sends BillStack a webhook once the purchase is known. BillStack turns that webhook into a project entitlement, the same way it does for Stripe and Razorpay events.

provider: "revenuecat" is not a valid value for /checkout/start. There is no RevenueCat checkout flow — connect it purely to keep entitlements in sync for users who purchase through a mobile app.

What this integration does

  • Verifies and stores a RevenueCat v2 secret API key per project.
  • Accepts RevenueCat webhook deliveries and updates the matching project's entitlement.
  • Does not create RevenueCat purchases, offerings, or checkout sessions.

Step 1: Create a RevenueCat v2 secret API key

  1. In the RevenueCat dashboard, open your project.
  2. Go to Project settings > API keys.
  3. Create a Secret API key (v2, sk_...), not a public/app SDK key.
  4. Scope the key to the permissions it actually needs — BillStack only reads project and entitlement data.

Step 2: Connect the key to BillStack

Dashboard UI

  1. Open your project's Billing dashboard and go to the Integrations tab.
  2. Find the RevenueCat card and click Connect.
  3. Paste the v2 secret API key and save.

BillStack validates the key before storing it — see Key validation below. If validation fails, the key is not saved and the form shows the reason.

API

curl -X PUT \
  "https://billing.w3dev.app/api/billstack/teams/{teamId}/projects/{projectId}/providers" \
  -H "Content-Type: application/json" \
  -H "Cookie: <session-cookie>" \
  -d '{
    "provider": "revenuecat",
    "secret": "sk_live_xxx"
  }'

provider and secret are required. The secret is encrypted (AES-256-GCM) before it is stored — BillStack never returns it in plaintext again.

Key validation

On every PUT, BillStack calls RevenueCat to confirm the key actually works before saving anything:

GET https://api.revenuecat.com/v2/projects
Authorization: Bearer <key>
ResponseResult
2xxKey is valid; provider config is saved.
401 / 403Key is invalid or lacks the required permissions; the request is rejected and nothing is saved.
429 or 5xxRevenueCat could not be reached to verify the key; BillStack returns a distinct "could not verify" error and does not save the key. Retry the request.

Step 3: Point RevenueCat webhooks at BillStack

BillStack exposes a per-project webhook endpoint for RevenueCat. Unlike Stripe and Razorpay — which recover the project from metadata embedded in the payment/subscription payload — RevenueCat events carry no BillStack project identifier, so projectId is part of the URL itself:

POST https://billing.w3dev.app/api/webhooks/revenuecat/{teamId}/{projectId}

Each RevenueCat project you connect gets its own webhook URL (RevenueCat webhooks are configured per RevenueCat project anyway, so this maps naturally: one RevenueCat project's webhook -> one BillStack project's URL).

In the RevenueCat dashboard:

  1. Go to Project settings > Integrations > Webhooks.
  2. Set the webhook URL to the endpoint above.
  3. Set the Authorization header value field to a static secret of your choosing, and/or enable Sign webhook payloads to get an HMAC signing secret. Configure at least one.
  4. Enter that same static header value and/or signing secret into BillStack's RevenueCat connection (Integrations tab, or via the same PUT /providers call using webhookSecret for the signing secret and metadata for the static header value). Both are encrypted before storage, matching how the API secret key is handled.

How webhook requests are verified

For each incoming delivery:

  1. If a signing secret is configured, BillStack computes an HMAC-SHA256 digest of the raw request body using that secret and compares it, byte-for-byte in constant time, against the X-RevenueCat-Webhook-Signature header. A mismatch is rejected with 401.
  2. If no signing secret is configured, BillStack instead does a constant-time comparison of the incoming Authorization header against the static value you set in step 3.
  3. If neither a signing secret nor a static header value is configured for the project, RevenueCat webhook requests are rejected — configure at least one before enabling the webhook in RevenueCat.

Supported RevenueCat events

Event typeWhat BillStack does
INITIAL_PURCHASECreates the entitlement and marks it active.
RENEWALRefreshes the subscription entitlement's current period.
PRODUCT_CHANGEUpdates the entitlement to reflect the new product/tier.
CANCELLATIONMarks the entitlement canceling (access continues until expiration).
UNCANCELLATIONReactivates a previously canceled entitlement.
EXPIRATIONMarks the entitlement expired and removes access.
BILLING_ISSUEFlags the entitlement so your app can prompt the user to fix payment, without immediately revoking access.
TRANSFERMoves the entitlement to the new app_user_id.
TESTAccepted and acknowledged so you can verify connectivity from the RevenueCat dashboard; it does not change entitlement state.

BillStack identifies the project from the {projectId} path segment, then matches the event to a customer within that project using RevenueCat's app_user_id, which must correspond to the externalId you use elsewhere in BillStack for that customer.

Retries and response time

RevenueCat expects your endpoint to return 200 within 60 seconds. If it doesn't, or if it returns a non-2xx status, RevenueCat retries the delivery up to 5 times, backing off at roughly 5, 10, 20, 40, and 80 minutes. Design any downstream side effects (like notifying your app) to be safe to run more than once for the same event.

What's out of scope

  • Starting or resuming checkout through RevenueCat — see Logged-in Checkout or Migrate from Razorpay for provider-driven checkout instead.
  • Reading RevenueCat offerings or product catalogs — BillStack only consumes entitlement-relevant webhook events.