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

# RevenueCat integration

> Record App Store and Google Play purchases from RevenueCat in Partnero, and pay partners for the app users they bring in.

[RevenueCat](https://www.revenuecat.com) runs in-app purchases and subscriptions for iOS and Android apps. Connect it to Partnero, and every purchase, renewal and refund from an app user a partner referred is recorded as a transaction, with the partner's commission calculated the same way as for web sales.

## What the integration does

* Records App Store and Google Play purchases, renewals and one-time purchases from referred app users.
* Reverses commissions when RevenueCat reports a refund.
* Follows the customer when RevenueCat transfers purchases to a new app user ID.
* Can leave tax and App Store or Google Play fees out of the commission.
* Works with affiliate programs, together with the [Swift](https://docs.partnero.com/sdks/swift.md) and [Android](https://docs.partnero.com/sdks/android.md) SDKs.

## How it works

Your app claims the partner's code for the user, and RevenueCat reports that user's purchases to Partnero through a webhook. Partnero matches the two by app user ID.

Setting this up takes five steps. Mobile app claims must be on first: turn on **Enable mobile app claims** in **Program settings** → **Tracking for mobile apps**. See [Mobile apps](https://docs.partnero.com/guides/tracking/mobile-app.md).

## Set up the integration

### Connect RevenueCat in Partnero

Go to **Integration** → **Payment processors** and click **Connect** on RevenueCat. Copy the **Webhook URL** and the **Authorization header value** from the window that opens.

### Create the webhook in RevenueCat

In your RevenueCat project, open **Integrations** → **Webhooks**, add a webhook and fill it in:

* **Webhook URL**: the URL from Partnero.
* **Authorization header value**: the value from Partnero.
* **Environment**: **Production**.

### Sign the webhook

Still in the RevenueCat webhook, turn on signing and copy the signing secret. Back in Partnero, paste it into **Webhook signing secret** and click **Connect**.

### Claim codes in your app

Use the [Swift](https://docs.partnero.com/sdks/swift.md) or [Android](https://docs.partnero.com/sdks/android.md) SDK to claim the partner's code for the app user ID that RevenueCat knows. Claim after `Purchases.logIn(...)`, because anonymous RevenueCat IDs can't be claimed.

### Make a real purchase

Claim a code in your app and buy something in production. The user shows up under **Customers**, and the commission appears on the partner's page.

> [!WARNING]
>
> Only production purchases count. Partnero skips RevenueCat sandbox events and purchases made in RevenueCat's Test Store.

## What gets tracked

| RevenueCat event | In Partnero |
| - | - |
| `INITIAL_PURCHASE`, `RENEWAL`, `NON_RENEWING_PURCHASE` | A transaction for the customer |
| `CANCELLATION` with reason `CUSTOMER_SUPPORT` | A refund of that purchase's transactions, which reverses their commissions |
| `TRANSFER` | The customer key changes to the new app user ID |

Partnero accepts every other event, such as expirations and billing issues, but doesn't act on it. A free trial has a zero price, so it creates no transaction; the first paid period comes in later as a `RENEWAL`. If RevenueCat sends the same event twice, it's still recorded once.

**Currency.** If the user paid in your program's currency, Partnero records that price. If not, and your program uses USD, it records RevenueCat's USD price. Programs with currency conversion turned on accept any currency and convert it. All other purchases are skipped.

**Tax and store fees.** In the RevenueCat window, **Choose what counts as revenue** has two switches: **Exclude tax** and **Exclude store fees**. By default both are off, and commissions are based on the full price. Turn them on to deduct RevenueCat's estimated tax and App Store or Google Play fee from each purchase first.

## How purchases are matched

Partnero compares the event's `app_user_id`, `original_app_user_id` and `aliases` with your customer keys. When none of them match a claimed customer, the purchase is skipped.

As a backup for claims that never arrived, for example from a device that was offline, Partnero also reads the `partnero_code` subscriber attribute. Set it at the moment the user enters a code:

```swift Swift theme={"system"}
Purchases.shared.attribution.setAttributes(
    Partnero.revenueCatAttributes(code: "DANIEL20")
)
```

```kotlin Kotlin theme={"system"}
Purchases.sharedInstance.setAttributes(
    Partnero.revenueCatAttributes("DANIEL20")
)
```

The attribute goes through the same claim rules, including the requirement that mobile app claims are on.

## Troubleshooting

> [accordion] Purchases are not appearing in Partnero
>
> Check that the webhook in RevenueCat sends **Production** events, and that the purchase wasn't made in the
> sandbox or the Test Store. Then confirm the user exists under **Customers**: a purchase from a user who was
> never claimed is skipped.

> [accordion] The customer exists but the purchase is attributed to nobody
>
> The purchase arrived under a different app user ID than the one you claimed. Claim with the same ID you
> give RevenueCat, after `Purchases.logIn(...)`, never with an anonymous `$RCAnonymousID:…` ID.

> [accordion] A purchase arrived but no transaction was created
>
> Free trials have a zero price and create no transaction. Purchases in a currency your program can't
> accept are also skipped; see the currency rules under [What gets tracked](#what-gets-tracked).

> [accordion] Claims fail with an unknown code
>
> **Enable mobile app claims** is off, or the partner isn't approved and active. Turn it on in
> **Program settings** → **Tracking for mobile apps**.

> [accordion] Disconnecting or reconnecting
>
> Click **Disconnect** on the RevenueCat card, and Partnero stops recording RevenueCat purchases. Reconnecting
> issues a new authorization value, so update it in the RevenueCat webhook as well.

## Next steps

> [card] [Mobile apps](https://docs.partnero.com/guides/tracking/mobile-app.md)
>
> Claims, app links and the claim rules

> [card] [Swift SDK](https://docs.partnero.com/sdks/swift.md)
>
> Claim codes and app links on iOS

> [card] [Android SDK](https://docs.partnero.com/sdks/android.md)
>
> Claim codes, app links and Google Play installs

> [card] [Commissions](https://docs.partnero.com/knowledge-base/commissions-rewards/guide-to-commission-set-up.md)
>
> Set up recurring commissions


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