Stripe Checkout revenue attribution

Pass XPmetric visitor IDs into Stripe Checkout metadata to attribute revenue to traffic sources.

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 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:

// Pass XPmetric visitor IDs into Stripe Checkout metadata
const visitorId = window.xpmetric?.v || "";
const sessionId = window.xpmetric?.s || "";

const session = await stripe.checkout.sessions.create({
  // ...your existing checkout options
  subscription_data: {
    metadata: {
      xpm_visitor_id: visitorId,
      xpm_session_id: sessionId,
    },
  },
  payment_intent_data: {
    metadata: {
      xpm_visitor_id: visitorId,
      xpm_session_id: sessionId,
    },
  },
});

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).