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

# RevenueCat integration

> Send RevenueCat purchases, renewals and refunds to Tolt and pay partners for the app users they refer.

RevenueCat reports every App Store and Google Play purchase to Tolt through a webhook. When the buyer is an app user who claimed a partner's code, Tolt records the purchase and creates the commission.

Your appTolt SDK + RevenueCatRevenueCatpurchasesToltattribution*1*claim SAM20 for user\_8f2k*2*purchase*3*INITIAL\_PURCHASE user\_8f2k*4*commission for Sam

## Set up

**1. Connect RevenueCat**

In the dashboard, go to **Settings → Integrations → RevenueCat**. The page shows your webhook URL and an authorization value.

**2. Add the webhook**

In RevenueCat, go to **Project settings → Integrations → Webhooks** and choose **Add new configuration**. Paste the URL from Tolt as the **Webhook URL**, and the authorization value into **Authorization header value**.

**3. Turn on webhook signing**

In the same webhook, turn on HMAC signing and copy the signing secret. Paste it into **Signing secret** in Tolt and save. Tolt rejects RevenueCat events until signing is set up.

**4. Claim codes in your app**

Add the [Swift](https://docs.tolt.com/sdks/swift.md) or [Android](https://docs.tolt.com/sdks/android.md) SDK and claim the partner's code for the same app user id you give RevenueCat. See [Mobile apps](https://docs.tolt.com/tracking/mobile-apps.md).

**5. Test it**

Click **Send test event** in RevenueCat. Tolt answers `200` and ignores it. Then claim a partner's code in your app and make a purchase. The customer appears under **Customers** and the commission under **Commissions**.

> [!WARNING]
>
> Tolt ignores RevenueCat's sandbox purchases, including the Test Store. Only production purchases create commissions.

## Details

> [accordion] Events Tolt uses
>
> | RevenueCat event | In Tolt |
> | - | - |
> | `INITIAL_PURCHASE`, `RENEWAL` | A `subscription` transaction |
> | `NON_RENEWING_PURCHASE` | A `one_time` transaction |
> | `CANCELLATION` with reason `CUSTOMER_SUPPORT` | A refund of that transaction |
> | `TRANSFER` | The customer moves to the new app user id |
>
> Other events, like expirations and billing issues, are acknowledged and ignored. The same store transaction is only ever recorded once, so RevenueCat's retries are safe.

> [accordion] Matching the app user
>
> Tolt looks for a customer whose `customer_id` is the event's `app_user_id`, its `original_app_user_id` or one of its `aliases`. Purchases from users who never claimed a code are ignored.
>
> If a purchase arrives before the claim, Tolt falls back to the `tolt_code` subscriber attribute. Set it when the user enters a code:
>
> ```swift Swift theme={"system"}
> Purchases.shared.attribution.setAttributes(
>   Tolt.revenueCatAttributes(code: "SAM20")
> )
> ```
>
> ```kotlin Kotlin theme={"system"}
> Purchases.sharedInstance.setAttributes(
>   Tolt.revenueCatAttributes("SAM20")
> )
> ```

> [accordion] Amounts and currency
>
> Tolt uses RevenueCat's USD price. When your program uses another currency, it takes the price in that currency if the user paid in it, and converts from USD otherwise.

> [accordion] Excluding tax and store fees
>
> The RevenueCat integration page has two switches: **Exclude tax** and **Exclude app store fees**. Both are off by default, so commissions use the full price. Turned on, Tolt subtracts the tax and store fee percentages RevenueCat estimates for each purchase.

> [accordion] Refunds
>
> A refund zeroes the transaction's unpaid commissions, and paid ones get a negative commission. See [Refunds](https://docs.tolt.com/guides/refunds.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.