# RevenueCat Integration (/docs/revenue/revenuecat)



## Setup [#setup]

Connection is via OAuth, initiated from the project's Revenue layer
settings:

1. Install the Revenue layer on the project.
2. In layer settings, click **Connect RevenueCat**.
3. You're redirected to RevenueCat's OAuth consent screen. Approve the
   requested scopes.
4. On callback, Layers lists your RevenueCat projects. Pick the one to
   bind to this Layers project.
5. The OAuth access + refresh tokens are stored in the
   [Layers credential vault](/docs/trust/vault). The account shows up
   as a `revenuecat_accounts` row linked to the project.

## Token rotation [#token-rotation]

RevenueCat access tokens are refreshed automatically on a short cadence.
If a token can't be refreshed (revoked, scope change), the integration
is marked unhealthy and the sync is skipped until reconnected.

## What gets synced [#what-gets-synced]

An hourly sync runs per account and calls RevenueCat's metrics APIs. The
following is captured:

* MRR, ARR, active subscribers, active trials.
* Churn rate, conversion rate, refund rate.
* LTV (subset — RevenueCat-sourced portion).
* Revenue and subscriber counts per product.
* 7-day and 30-day revenue and new-subscriber totals.

## Webhooks [#webhooks]

Layers exposes `POST /api/webhooks/revenuecat` for real-time
subscription-lifecycle events. The endpoint is authenticated via a
bearer token that matches a per-project webhook secret stored in
Vault. Events are written to `revenue_events`.

Configure the webhook in the RevenueCat dashboard pointing at that URL
with the bearer token shown in the layer settings.

## Multi-project [#multi-project]

One Layers project can link to multiple RevenueCat projects (each
creates its own `revenuecat_accounts` row). The Revenue dashboard
shows the union, filterable via the account picker.

## Disconnect [#disconnect]

From the layer settings, click **Disconnect**. The connection is
removed and the stored tokens are deleted from Vault. Historical
metrics already written to Layers remain visible.
