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

# Checkout Attribution

> Tie a Fanvue checkout payment back to a record in your own system using the client_reference_id parameter on the link and passthrough metadata fields.

Attribution is the practice of linking a Fanvue payment or event back to the
record, customer, or marketing source in your own system that originated it, for
example tying a sale to a CRM contact, an affiliate, or a campaign. You attach
your own identifiers when the buyer reaches the checkout, and Fanvue carries them
through unchanged on every related webhook, so you can reconcile activity in your
own system without storing anything extra on Fanvue.

Both `client_reference_id` and `metadata` are **optional**, captured at checkout,
persisted on the resulting payment and subscription, propagated to renewals, and
echoed back on every checkout event.

## `client_reference_id`

A single opaque string (your order id, customer id, or session id, up to **200
characters**). Append it to the checkout link URL:

```
https://www.fanvue.com/checkout/<link>?client_reference_id=your-crm-id-123
```

It appears on every event as `data.client_reference_id`.

## `metadata`

A flat key/value map for richer attribution (for example an affiliate id plus a
campaign). Pass each entry as a `metadata[<key>]` query parameter:

```
https://www.fanvue.com/checkout/<link>?metadata[affiliate_id]=aff_123&metadata[campaign]=spring
```

It appears on every event as `data.metadata`:

```json theme={null}
"metadata": { "affiliate_id": "aff_123", "campaign": "spring" }
```

<Note>
  `metadata` is sanitized to a flat string-to-string map at capture time.
  Limits: up to **10 keys**, each key up to **40 characters**, each value up to
  **200 characters**. Non-string or out-of-range entries are dropped; if nothing
  valid remains, `metadata` is `{}`.
</Note>

Both values are passthrough-only: Fanvue never interprets them. Do not put
secrets in them, as they are echoed back verbatim in the webhook payload.

Next: [Configuring checkout webhooks](/docs/checkout/configuring), or browse
the [event reference](/docs/checkout/overview#available-events).
