---
title: "Stripe Affiliate Tracking Across App and Web Checkout"
description: "Stripe affiliate tracking across an app and a web checkout: which user id joins RevenueCat to Stripe, and the two cases that pay one creator twice."
canonical: https://www.myappaffiliate.com/blog/stripe-revenuecat-affiliate-tracking
published: 2026-11-19
author: "Cuma Ali Kesici"
category: "Attribution"
tags: [Stripe, RevenueCat, Web, iOS]
source: MyAppAffiliate
---

# Stripe Affiliate Tracking Across App and Web Checkout

Stripe affiliate tracking for a product that also sells inside a mobile app reduces to one string. The id Stripe reports on `invoice.paid` has to be the same id RevenueCat reports as `app_user_id`. When it is, both surfaces land in one commission ledger with one rate and one hold period. When it is not, every dashboard looks healthy and no commission is ever created.

[One attribution engine for mobile and web](/blog/one-attribution-engine-mobile-and-web) argues why a single engine across both surfaces is the right shape, and this post assumes you agree. What follows is the wiring: which id to make the identity, how to carry it through Stripe Checkout, how to make RevenueCat echo it, and what happens when one person subscribes on both. Every field below was read from the vendor's live reference on 2026-11-10.

## Key takeaways

- The join is one string. Both billing systems have to report it unchanged.
- Stripe never copies subscription metadata onto a Charge, so refunds arrive without your id.
- Two paid subscriptions for one human are two commissions. Nothing merges them.
- RevenueCat caps the App User ID at 100 characters, so pick an id that fits both.
- A chargeback is not one of the four Stripe events, so it reverses nothing.

## A hybrid product breaks at the join, not at either integration

Both integrations are short. Stripe posts `invoice.paid`, RevenueCat posts `INITIAL_PURCHASE`, and each is a handler you can write before lunch. What breaks is the join: two systems describing one human with two identifiers, while a creator is owed one number.

Our own [Billing and Webhooks reference](https://docs.myappaffiliate.com/webhooks) calls a mismatch between the id you identify with and the id that arrives in the revenue event "the single most common integration failure". It tops the list because it does not error. Clicks arrive, signups arrive, revenue events arrive, the funnel chart fills in, and the commission table stays empty, because no row in it can be created from an id that matches nothing.

Our opinion: pick the identity before you write either integration. It is a fifteen minute decision that you cannot make again cheaply once there are commissions on file keyed to the wrong string.

## What Stripe affiliate tracking needs from a mobile app and a web checkout

One string, chosen by you, reported unchanged by both providers. Attribution joins on your user id and nothing else. No affiliate id or creator code enters Stripe or RevenueCat at any point, which is why neither vendor needs to know your affiliate program exists.

![One person holding a Stripe customer id and a RevenueCat app user id that do not match](https://www.myappaffiliate.com/blog-images/stripe-revenuecat-affiliate-tracking/stripe-revenuecat-affiliate-tracking-two-ids-one-person.webp "The same human, described twice, by two systems that never talk to each other.")

Three ids are available and only one is a good identity. The constraints that decide it are vendor limits rather than preferences.

| Candidate | Where it comes from | Hard limit | Why it wins or loses |
| --- | --- | --- | --- |
| Your own user id | Your database, at signup | RevenueCat caps App User IDs at 100 characters | Wins. It is the only id that exists before either provider does, and it survives a provider swap |
| Stripe customer id | Stripe, at first checkout | Exists only once a checkout has happened | Loses for app-first users, who have no Stripe customer. It does make Stripe refunds joinable, which matters later |
| RevenueCat App User ID, anonymous | The RevenueCat SDK, at first launch | Generated per install | Loses. RevenueCat generates anonymous ids by default and a purchase made on one belongs to nobody you can pay a creator for |

RevenueCat's [identifying customers guide](https://www.revenuecat.com/docs/customers/identifying-customers) sets that ceiling at 100 characters and rules out the shortcut most teams reach for first: "For the above reasons about guessability, and GDPR compliance, we don't recommend using email addresses as App User IDs." Verified on 2026-11-10.

Stripe is the looser of the two. [Its Checkout Session reference](https://docs.stripe.com/api/checkout/sessions/create) gives `client_reference_id` a maximum length of 200 characters, and [the metadata reference](https://docs.stripe.com/api/metadata) allows 50 keys per object, keys up to 40 characters and values up to 500. Both verified on 2026-11-10. So RevenueCat is the binding constraint on a hybrid product, and a version 4 UUID at 36 characters clears both with room to spare. That is what we would use, and it is what RevenueCat recommends: "A non-guessable pseudo-random ID, like a UUID (RFC 4122 version 4), is recommended." Stripe's metadata reference adds the other half of the argument against an email address: do not store sensitive information in metadata.

## Carrying that id through Stripe Checkout, and the field that moves

Two fields, one per mode, and the subscription one is not the one most people set. Session level `metadata` never reaches an invoice, so a subscription stamped only there reports no id of yours on any renewal.

The code is copied from [the Web SaaS guide](https://docs.myappaffiliate.com/web-saas), which has the whole web loop in order:

```typescript
await stripe.checkout.sessions.create({
  mode: "subscription",
  line_items: [{ price: "price_…", quantity: 1 }],
  subscription_data: {
    metadata: { customer_user_id: user.id },  // renewals read this
  },
  client_reference_id: user.id,               // one-time payments read this
  success_url: "https://yourapp.com/welcome",
  cancel_url: "https://yourapp.com/pricing",
});
```

The two lines do different jobs. Stripe describes `client_reference_id` as "A unique string to reference the Checkout Session", and it rides on the session, so it is present on `checkout.session.completed` and absent from every invoice afterwards. `subscription_data.metadata` writes to the underlying subscription, which is the object that outlives the checkout.

From there the value takes one more hop, and this is the part worth reading twice. Stripe's [metadata guide](https://docs.stripe.com/metadata) states that an object's metadata does not automatically copy to related objects, then lists four exceptions. One of them is the subscription to invoice copy, which lands in `parent.subscription_details.metadata` as, in Stripe's words, "a one-time snapshot". The Invoice reference calls it "an immutable snapshot of the subscription metadata at the time of invoice finalization", populated only for invoices created on or after June 29, 2023. All verified on 2026-11-10. So a user id corrected in month four leaves months one to three keyed to the old string.

The location of that snapshot also moved. Stripe's [Basil changelog entry](https://docs.stripe.com/changelog/basil/2025-03-31/adds-new-parent-field-to-invoicing-objects) lists `subscription`, `subscription_details`, `quote` and `subscription_proration_date` as removed from the Invoice object in `2025-03-31.basil`, replaced by `parent`. Webhook endpoints carry their own version: "Each webhook endpoint has a specific API version. Stripe uses that version to structure the event payloads it sends to the endpoint." Verified on 2026-11-10.

> **Note:** If a test-mode web subscription produces no commission, check the API version on the Stripe endpoint before the signing secret and before the SDK. The payload shape your handler expects and the one Stripe sends are configured in two different places.

Register the endpoint at `https://api.myappaffiliate.com/webhooks/stripe/<appId>` and select four events: `invoice.paid`, `charge.refunded`, `customer.subscription.deleted` and `checkout.session.completed`. Deliveries are verified against the endpoint's `whsec_` secret as a timestamped HMAC in `Stripe-Signature`, and a bad signature is recorded and rejected with `401`.

`invoice.paid` does double duty, because Stripe uses one event for a first charge and a renewal. The distinction is `billing_reason`, which Stripe documents as `subscription_create` for "A new subscription was created" and `subscription_cycle` for "A subscription advanced into a new period". Those become our `purchase` and `renewal`. `checkout.session.completed` is handled for `mode: payment` only: a subscription checkout is counted from its first `invoice.paid`, so nothing is double counted when both events fire for one sale.

One-time sales need one extra field. On a `mode: payment` session Stripe does not send line items to a webhook, so add `metadata: { product_id: "lifetime_access" }` and the sale arrives naming what was bought. The value is yours to choose, and it is what lets a later refund reverse the right purchase when a customer has bought more than one thing.

## Making RevenueCat report the same string

One call, and it is the same string you stamped into Stripe. RevenueCat's App User ID is set with `logIn`, and its [identifying customers guide](https://www.revenuecat.com/docs/customers/identifying-customers) says you "can set (or change) the App User ID at any time by calling `.logIn()`". Verified on 2026-11-10.

```swift
// The same id you put in subscription_data.metadata.customer_user_id.
Purchases.shared.logIn(user.id) { (customerInfo, created, error) in
  MyAppAffiliate.identify(userId: user.id)
}
```

Call both before the purchase rather than after it. RevenueCat defines `app_user_id` on the webhook as the "Last seen App User ID of the subscriber", and one subscriber can be referenced by several ids at once, which RevenueCat calls aliases. A purchase made on an anonymous id and only later aliased to yours carried the wrong string at the moment it mattered. The full mobile side is in [the RevenueCat attribution guide](/blog/revenuecat-affiliate-tracking).

Nothing else changes on the app side. There is no affiliate id to pass into RevenueCat, no subscriber attribute to set, and no second SDK key.

## One person, two subscriptions, and who gets paid

Say it plainly, because the honest answer surprises people. When the ids match, a person who subscribes on web and again in the app produces two commissions, and both are correct. When the ids differ, the two halves are two people in the ledger and the second creator earns nothing.

![Each billing event beside the field that carries the user id and the field that carries the amount](https://www.myappaffiliate.com/blog-images/stripe-revenuecat-affiliate-tracking/stripe-revenuecat-affiliate-tracking-join-table.webp "Four Stripe events and three RevenueCat ones, with the id each payload actually carries.")

The matching case first. Two paid subscriptions are two charges, usually days apart, under product ids that do not resemble each other: a Stripe `price_` id on one side and a store product identifier on the other. Our idempotency is keyed per source and per source event id, which by construction never collides across providers. So both events are stored, both are commissionable, and both pay. The customer really was charged twice.

That is the case we cannot dedupe, stated as a limit rather than a feature: **one human holding two paid subscriptions to the same product, one through Stripe and one through the App Store, under the same user id, is two commissionable purchases to us.** We cannot distinguish it from two people in a household, and we do not try. The remedy is on your side. Detect the duplicate entitlement, refund one, and if the refund lands inside the hold period the commission never pays out at all.

The mismatched case is quieter. If the app identifies `u_7f21` while Stripe reports a bare `cus_` id, because nobody stamped the metadata, the web revenue attaches to an identity your click records have never seen. The invoice still earns a commission if you called `identify(stripeCustomerId)` on the web side, which our docs offer as a deliberate second option, but then the same human's app subscription sits under a different identity and the two never reconcile. Two rows, one person, and nothing we run builds an identity graph to join them.

Which click wins when one person taps two creators on two devices is settled upstream of all of this, by last touch inside the attribution window. [How attribution windows work](/blog/how-attribution-windows-work) has the derivation.

## Refunds and chargebacks are not symmetrical across the two

RevenueCat refunds join on the same id as the purchase. Stripe refunds do not, and the reason is a documented Stripe behaviour rather than anything either of us chose.

A RevenueCat refund arrives as a `CANCELLATION`, which RevenueCat describes as "A subscription or non-renewing purchase was canceled or refunded", with `cancel_reason` set to `CUSTOMER_SUPPORT`. There is no event called `REFUND`, so a handler keyed on one never fires. The payload carries `app_user_id`, the same string the purchase carried.

A Stripe refund arrives as `charge.refunded`, which Stripe documents as occurring "whenever a charge is refunded, including partial refunds". The payload object is a Charge, and Stripe's four metadata exceptions do not include invoice to Charge or subscription to Charge. So the refund of a web subscription carries the Stripe customer id and no id of yours, whatever you stamped at checkout.

| Case | Refund payload | Your id present? | Practical effect |
| --- | --- | --- | --- |
| App subscription, RevenueCat | `CANCELLATION`, `cancel_reason: CUSTOMER_SUPPORT` | Yes, `app_user_id` | Reverses cleanly against the purchase |
| Web subscription, Stripe | `charge.refunded`, a Charge | No, the Stripe customer id only | Joins only if that customer id is also what you identified with |
| Web one-time sale, Stripe | `charge.refunded`, a Charge | Yes, if you set `payment_intent_data.metadata` | PaymentIntent to Charge is a documented metadata copy, so use it |

The one-time row is the usable one. Stripe does copy PaymentIntent metadata to the Charge in a one-time snapshot, and `payment_intent_data.metadata` on a `mode: payment` session writes to that PaymentIntent, so a lifetime plan can be made to refund correctly with one more line in the session. A subscription cannot: its PaymentIntents are created by Stripe at invoice finalization and you never get to stamp them.

Two smaller asymmetries matter for a hold period. Stripe's `charge.refunded` fires on partial refunds and `amount_refunded` is cumulative, so two partial refunds deliver two events whose amounts sum to more than the money returned. And a chargeback is not a refund. Stripe's dispute flow "Debits the disputed amount, plus a dispute fee, from your Stripe account", holds those funds "for the entire duration of the dispute", and allows cardholders 120 days from the original payment to open one. None of it produces a `charge.refunded`, and `charge.dispute.created` is not one of the four events we ask you to select, so a lost chargeback leaves its commission payable. [The clawback policy post](/blog/affiliate-clawback-policy-subscription-apps) covers the terms to write for that.

## The combined ledger, with the arithmetic shown

Commission is `amount_usd_cents × rate_bps / 10000` on the gross amount, created `pending` and `matured` after the hold period, whichever provider produced the event. Here is what the hybrid double-subscribe case does to real numbers.

One app, a 20 percent rate, a 30 day attribution window, a 14 day hold. Creator A drove a laptop click on 3 November and the visitor signed up as `u_7f21`, taking the $120.00 annual web plan. On 20 November the same person installed the iOS app from Creator B's link, logged in as `u_7f21`, and bought the $15.00 monthly in-app plan. On 3 December support refunded the duplicate web subscription in full.

| Date | Surface | Event | Gross | Creator | Commission | Status on 21 December |
| --- | --- | --- | --- | --- | --- | --- |
| 3 Nov | Web, Stripe | `invoice.paid`, `subscription_create` | $120.00 | A | $24.00 | matured 17 Nov |
| 20 Nov | App, RevenueCat | `INITIAL_PURCHASE` | $15.00 | B | $3.00 | matured 4 Dec |
| 3 Dec | Web, Stripe | `charge.refunded` | $120.00 returned | A | reversal needs the id | see below |
| 20 Dec | App, RevenueCat | `RENEWAL` | $15.00 | B | $3.00 | pending, matures 3 Jan |

The arithmetic: 12000 × 2000 / 10000 is 2400 cents, and 1500 × 2000 / 10000 is 300 cents, twice. Revenue you keep after the refund is $30.00. Commissions created are $30.00. On the documented setup, where you stamped your own user id into `subscription_data.metadata`, the refund arrives naming `cus_` and the $24.00 earned on money you gave back is still in the ledger. Had you identified with the Stripe customer id instead, that $24.00 moves to `clawed_back` and the total is $6.00 on $30.00, which is the 20 percent you actually agreed.

That is the trade in one table: identify with your own id and purchases join perfectly while subscription refunds do not, or identify with Stripe's customer id and both join while every app-first user needs a Stripe customer they do not have. We pick the first and watch the refund report, because a missed reversal is visible in a reconciliation and a missing commission is not. Payout mechanics, including what matures and when, are in [paying commissions on subscriptions](/blog/affiliate-commissions-payouts-subscriptions).

Creator B's 20 December renewal earns because the subscriber was acquired inside the attribution window, not because the window is still open: a separate commission duration clock decides how long renewals keep paying, and blank means for life.

## Verify the web half first, then the app half

Order matters, and the web surface proves the ledger in an afternoon with no store review in the way. Everything below is test mode, which is recorded and visible but never earns a commission, because we read `livemode` from Stripe and `environment` from RevenueCat.

1. Onboard the app once and keep the output: one appId, one SDK key, and a webhook URL plus secret per provider.
2. Start the Web SDK in your root layout and identify at signup, client side or with `trackSignup` on the server.
3. Stamp the same id into `subscription_data.metadata.customer_user_id` and `client_reference_id` at checkout.
4. Register the Stripe endpoint, select the four events, and check the API version Stripe shows on it.
5. Run one test-mode subscription and confirm a pending commission appears against the right creator.
6. Refund that test subscription and look at what the reversal did, before a real customer does it for you.
7. Add the mobile SDK, call your provider's `logIn` and `identify` with the same id, and register the RevenueCat endpoint.
8. Set the rate, window and hold once in app settings, so both surfaces inherit them.

Step 6 is the one nobody runs, and it is the step that tells you which of the two id strategies above your refunds actually need.

MyAppAffiliate is a reasonable fit when one subscription product bills through more than one platform and you want one number per creator: flat subscription pricing rather than a cut of your revenue, first-party attribution with no IDFA and no fingerprinting, and RevenueCat, Adapty, Superwall, Stripe and Paddle handled natively. It is a poor fit for paid-media measurement, which is an MMP's job and not ours. Commission runs on gross on both sides, with no per-app gross or net switch, so set a rate that is net-equivalent for your store cut if that is the deal you quoted.

Start at step 2 and stop at step 6. If the program itself does not exist yet, [launching a first affiliate program](/blog/launch-first-affiliate-program) is the order to do it in.

## FAQ

### Which id should I use when both Stripe and RevenueCat bill the same product?

The id your own database already owns, as long as it fits inside 100 characters. RevenueCat documents that limit for App User IDs and recommends a random UUID. Stripe allows 200 characters in `client_reference_id` and 500 in a metadata value, so RevenueCat is the binding constraint on both surfaces.

### Does Stripe put my subscription metadata on the refund event?

No. Stripe documents that metadata does not copy to related objects, with four exceptions, and none of them reaches a Charge from a subscription or an invoice. A `charge.refunded` payload for a web subscription therefore carries the Stripe customer id and nothing else of yours.

### If one person subscribes on web and again in the app, is the creator paid twice?

Yes, and both commissions are real. Two paid subscriptions are two charges with different product ids, days apart, so they are two commissionable purchases. Nothing in our engine decides that one human only meant to pay once. Refund the duplicate and the hold period does the rest.

### Do I need two MyAppAffiliate webhook endpoints for Stripe and RevenueCat?

Yes, one per provider, both under the same appId. Onboarding provisions a URL and a signing secret for each of the five supported providers, and you configure only the ones you use. The rate, attribution window and hold period are app settings, so both endpoints inherit them.

### Why does my web subscription produce no commission at all?

The user id did not arrive. Check the API version pinned to your Stripe webhook endpoint first: Stripe moved `subscription_details` under a new `parent` field on the Invoice in `2025-03-31.basil`, so the snapshot of your subscription metadata is not where an older integration looks for it.
