> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linkrunner.io/llms.txt
> Use this file to discover all available pages before exploring further.

# RevenueCat

Source: https://docs.linkrunner.io/analytics-integrations/revenuecat

Connect RevenueCat to track revenue and subscription data in Linkrunner with automatic webhook-based event mapping

Linkrunner integrates with RevenueCat to automatically track revenue and subscription data. Once configured, RevenueCat will send webhook events whenever subscription or revenue events occur. Linkrunner will automatically match these events with attributed users to provide you with revenue analytics per campaign.

## How it works

Unlike other analytics integrations that push data from Linkrunner, RevenueCat uses a **webhook-based** approach:

1. RevenueCat sends webhook events to Linkrunner whenever a subscription or revenue event occurs
2. Linkrunner automatically matches these events with attributed users
3. RevenueCat events are automatically mapped to Linkrunner revenue types
4. Events are categorized into three status types based on payment outcome

## Prerequisites

| Requirement        | Description                                                              |
| ------------------ | ------------------------------------------------------------------------ |
| Linkrunner account | A Linkrunner account is required to take advantage of this integration.  |
| RevenueCat account | A RevenueCat account with webhook access.                                |
| iOS or Android app | This integration supports iOS and Android apps.                          |
| Linkrunner SDK     | You must have the [Linkrunner SDK](https://docs.linkrunner.io/) installed in your app. |

## Steps to setup

**1. Navigate to Integrations**

In your Linkrunner dashboard, click on **Integrations** from the left-hand panel. Under the **Analytics** section, find **RevenueCat** and click **Configure**.

![Navigate to RevenueCat integration](https://docs.linkrunner.io/images/revenueCat/RevenueCat%201.png)

**2. Copy the Webhook URL**

In the RevenueCat configuration panel, you'll see the **Webhook URL**. Copy this URL. You'll need to add it to your RevenueCat dashboard.

The webhook URL is: `https://api.linkrunner.io/webhook/revenuecat`

![Copy the webhook URL](https://docs.linkrunner.io/images/revenueCat/RevenueCat%202.png)

**3. Generate an Authorization Token**

Click **Generate Authorization Token** in the Linkrunner configuration panel. Copy the generated token. You'll need this for the authorization field in RevenueCat.

![Generate authorization token](https://docs.linkrunner.io/images/revenueCat/RevenueCat%203.png)

**4. Configure Webhook in RevenueCat**

Now head to your RevenueCat dashboard to set up the webhook:

1. In your [RevenueCat dashboard](https://app.revenuecat.com), navigate to the **Integrations** page from the left sidebar
2. Under **RevenueCat core tools**, click on **Webhooks** to configure the integration

![RevenueCat Integrations page - click on Webhooks](https://docs.linkrunner.io/images/revenueCat/RevenueCat%20dashboard%201.png)

3. Click **Add Webhook** and fill in the following details:
   - **Webhook name**: `Linkrunner`
   - **Webhook URL**: Paste the webhook URL copied from the Linkrunner dashboard
   - **Authorization header value**: Paste the authorization token generated in the Linkrunner dashboard
   - **Environment to send events for**: Select **Both Production and Sandbox** (recommended)
   - **Events filter**: Select **All apps** and **All events** (recommended)
4. Click **Add webhook** to save

![RevenueCat New Webhook configuration](https://docs.linkrunner.io/images/revenueCat/RevenueCat%20dashboard%202.png)

## Event Type Mapping

RevenueCat events are automatically mapped to Linkrunner revenue types. For subscription events, Linkrunner reads `period_type` and `is_trial_conversion` from the webhook payload to keep trial activity separate from real payments:

| RevenueCat Event        | Condition                     | Linkrunner Revenue Type      | Description                                  |
| ----------------------- | ----------------------------- | ---------------------------- | -------------------------------------------- |
| INITIAL_PURCHASE       | `period_type` = TRIAL         | TRIAL_STARTED               | Free trial started (no revenue)              |
| INITIAL_PURCHASE       | `period_type` = NORMAL        | FIRST_PAYMENT               | First paid purchase                          |
| RENEWAL                 | `is_trial_conversion` = true  | FIRST_PAYMENT               | Trial converted to paid (first real payment) |
| RENEWAL                 | `is_trial_conversion` = false | SUBSCRIPTION_RENEWED        | Subscription renewal payment                 |
| NON_RENEWING_PURCHASE |                               | ONE_TIME                    | One-time purchase                            |
| CANCELLATION            | `period_type` = TRIAL         | TRIAL_CANCELLED             | User cancelled during trial                  |
| CANCELLATION            | `period_type` = NORMAL        | SUBSCRIPTION_CANCELLED      | User cancelled a paid subscription           |
| UNCANCELLATION          |                               | SUBSCRIPTION_RENEWED        | User reactivated subscription                |
| REFUND                  |                               | SUBSCRIPTION_REFUNDED       | Payment refunded to user                     |
| BILLING_ISSUE          |                               | SUBSCRIPTION_BILLING_ISSUE | Payment failed or billing problem            |
| PRODUCT_CHANGE         |                               | SUBSCRIPTION_RENEWED        | User changed subscription tier               |
| EXPIRATION              |                               | DEFAULT                      | Subscription expired naturally               |

> **Note:**
>
> FIRST_PAYMENT always means a real paid transaction. If your app offers a free trial, the trial start arrives as TRIAL_STARTED and the trial-to-paid conversion arrives as FIRST_PAYMENT. Use TRIAL_STARTED for trial-optimization events (for example, mapping to Meta's StartTrial) and FIRST_PAYMENT for purchase events.

## Event Status Mapping

Events are categorized into three statuses based on the payment outcome:

| Status                | Events                                                                               |
| --------------------- | ------------------------------------------------------------------------------------ |
| **Payment Completed** | INITIAL_PURCHASE, RENEWAL, NON_RENEWING_PURCHASE, UNCANCELLATION, PRODUCT_CHANGE |
| **Payment Failed**    | BILLING_ISSUE                                                                       |
| **Payment Cancelled** | CANCELLATION, REFUND                                                                 |

## Viewing Revenue Data

After the integration is complete, Linkrunner will automatically:

- Match incoming RevenueCat events with attributed users
- Map events to the corresponding Linkrunner revenue types
- Provide revenue analytics per campaign in your Linkrunner dashboard

This data helps you understand which campaigns are driving the most valuable users in terms of subscription revenue and lifetime value.

**Need help?** Contact <support@linkrunner.io>.
