---
title: "Stripe Checkout revenue attribution"
description: "Pass XPmetric visitor IDs into Stripe Checkout metadata to attribute revenue to traffic sources."
source: "https://xpmetric.com/docs/revenue/stripe-checkout"
---
Connect Stripe in **Settings → Integrations**, then pass XPmetric visitor IDs into Checkout metadata so payments tie back to first-touch channel, referrer, and landing page.

## Prerequisites

1. [Install p.js](/docs/getting-started) on your site.
2. Connect Stripe with a restricted API key in **Settings → Integrations → Stripe**.
3. Create Checkout sessions **server-side** (Stripe API) so you can set metadata.

Static Payment Links cannot carry per-visitor metadata.

## Pass visitor IDs

`p.js` exposes:

- `window.xpmetric.v` — visitor hash
- `window.xpmetric.s` — session id

Add both to Checkout Session metadata:

<StripeCheckoutSnippet />

XPmetric's Stripe sync reads `xpm_visitor_id` and `xpm_session_id` from subscription invoice metadata and PaymentIntent metadata automatically.

## Verify

1. Complete a test checkout on your site.
2. Open **Channels** or **Revenue breakdown** on the site dashboard — the payment should appear with attribution once sync runs (~5 min, or click **Sync Now** in Settings).

## Related

- [Polar attribution](/docs/revenue/polar) — same metadata pattern for Polar
- [Payments API](/docs/revenue/payments-api) — record payments from any provider

