Stripe Payment Links attribution: find the channel behind each sale

Stripe stores no campaign or referrer for a Payment Link sale. See what it does keep, 3 ways to tag each sale with its channel, and how renewals inherit it.

Muzahid Maruf — Founder of TrackRev.io

Muzahid MarufUpdated

Stripe attribution · 7 min read
On this page
  1. 01What does Stripe keep from a Payment Link sale?
  2. 02Why do Google Analytics 4 and Safari lose the source?
  3. 03Which 3 methods work for Payment Links attribution?
  4. 04How do subscriptions, delayed payments and refunds change attribution?
  5. 05What does TrackRev read from Payment Link sales?
  6. 06When is your own webhook enough?

Explore with AI

Opens this article inside the chosen assistant with a ready-made prompt.

Stripe Payment Links attribution means tagging each sale with the channel that produced it, using the only fields that reach the sale: the client_reference_id (200 characters) and link metadata (50 keys, 500-character values).

UTM codes on a link reach only your redirect URL, because no Stripe API object has a field for them.

The Checkout Session has no referrer field either, and you publish no pages on buy.stripe.com, where the Google tag for Google Analytics 4 would have to run.

This guide covers 3 methods: a link per channel, a visitor ID joined on the Stripe webhook, and a redirect page. For example, a $49 template pack sold through 3 links shows how Method 1 counts sales in October 2026.

Key takeaways

  • UTM codes reach only your redirect URL and never the Checkout Session, so the source must ride in client_reference_id or link metadata.
  • Stripe's limits: 150 characters per UTM value, 50 metadata keys per object, and a 200-character client_reference_id that a 36-character UUID fits.
  • A renewal creates no Checkout Session, so copy the channel onto the subscription after payment 1.
  • TrackRev is affiliate software with attribution built in, and its pixel tags buy.stripe.com links on its own, and revenue figures start at $29 a month.

Stripe keeps only 2 channel fields from a Payment Link sale (October 2026): first, the client reference ID, and second, link metadata. Stripe's page on tracking a payment link lists 5 UTM codes and the client_reference_id parameter.

UTM codes work only with redirect confirmation, and Stripe appends them to that redirect URL. The Checkout Session object has no UTM field, and Stripe's OpenAPI spec for API version 2026-09-30 has no utm_ field on any object.

FieldWhere you set itWhere Stripe puts itLimit or catch
UTM codesQuery string of the link URL (5 codes)Appended to your redirect URL after paymentRedirect confirmation required; 150 characters per value; no Session field keeps them
client_reference_idLink URL, Buy Button or pricing table attributeCheckout Session and the checkout.session.completed event200 characters; letters, digits, dashes, the _ character; invalid values dropped silently
Link metadataPayment Link API objectCopied onto each Checkout Session the link creates50 keys, 40-character key names, 500-character values; same for every buyer
payment_intent_data.metadataPayment Link API objectPaymentIntents the link creates in payment modeOne-time prices only
subscription_data.metadataPayment Link API objectSubscriptions the link createsNeeds at least 1 recurring price
Link analyticsAutomaticPayments and analytics tab in the Stripe DashboardViews, sales and revenue only; up to 18 hours late; unavailable for recurring prices

Sources: Stripe's payment link tracking page, metadata guide and API reference for creating a payment link, October 2026.

Link metadata is the same for every buyer, so link metadata names a channel only when each channel has its own link.

Setting the metadata is an API job, since the Stripe Dashboard steps on Stripe's tracking page cover only the client reference ID.

Why do Google Analytics 4 and Safari lose the source?

Google Analytics 4 loses the source because the purchase happens on Stripe's domain, not yours. Google's cross-domain setup needs the same G- tag ID on every domain in the measurement. You publish no pages on Stripe's domain.

Google Analytics 4 can therefore log the click on your page but never the purchase. The GA4 revenue-by-channel guide shows the symptoms.

Safari loses the source in a different way. According to WebKit's Intelligent Tracking Prevention notes, Safari deletes script-written cookies and localStorage after 7 days without interaction.

For example, a newsletter reader who buys 8 days after the click arrives with no stored ID. A Set-Cookie header from your own server falls outside that rule, so set the ID there. The Safari ITP post covers the rest.

Three methods attribute Payment Links sales, and volume decides between them. Method 1 is one Payment Link per channel, which fits 2 or 3 channels.

Method 2 is a visitor ID joined on the Stripe webhook, which affiliates, many placements and renewals need. Method 3 is a redirect page, which adds UTM capture to a thank-you page you already run.

According to Stripe (October 2026), all 3 methods rely on the fields in the table above. Each method below lists its setup, its numbers and its catch.

In practice, start with Method 1 in October 2026 and move up only when a list of links becomes unmanageable.

One Payment Link per channel is the no-code method: create a Payment Link per placement and read Stripe's per-link numbers in the Payments and analytics tab. The tab skips links with recurring prices, so the method suits one-time products.

To keep an exportable reference, click the arrow beside Copy, choose URL parameters, then Client reference ID, and enter a value such as nl-2026-10 for the October newsletter.

An example with made-up numbers: a $49 template pack sells through 3 URLs, with 14 sales on the newsletter link, 6 on a Google Ads link and 2 on the affiliate link.

Revenue is $686, $294 and $98, which sums to $1,078. Refund 2 of the 14 newsletter sales and the newsletter link's net revenue falls to 12 × $49 = $588.

Against a made-up $250 of Google Ads spend, the 6 sales return $294, or $1.18 per $1. The 3 links account for all 22 sales. Every new placement costs a new URL.

Method 2: How does a visitor ID joined on the webhook work?

A visitor ID is a UUID created on the first visit and kept in a first-party cookie. The method has 3 parts. First, save the landing page, referrer and UTM codes against the ID (the script below does this).

Second, add the UUID as client_reference_id to each Payment Link, because its 36 characters fit the 200-character limit. Third, join the reference to the stored visit when the paid event arrives.

The cookie in the script below lasts 1 year (Max-Age 31536000).

Your pages: create the ID and tag the links
// On your own pages, before the visitor can click a Payment Linkfunction visitorId() {  var m = document.cookie.match(/(?:^|; )cid=([^;]+)/);  if (m) return m[1];  var id = crypto.randomUUID(); // 36 characters: hex digits and dashes  document.cookie = "cid=" + id + "; Max-Age=31536000; Path=/; SameSite=Lax; Secure";  return id;} var cid = visitorId(); // Send the landing context; your endpoint keeps the first row per IDnavigator.sendBeacon("/api/visits", JSON.stringify({  cid: cid,  landing: location.href,  referrer: document.referrer})); document.querySelectorAll('a[href^="https://buy.stripe.com/"]').forEach(function (a) {  var u = new URL(a.href);  u.searchParams.set("client_reference_id", cid);  a.href = u.toString();});

On the paid event, the handler joins the reference to the stored visit and writes the channel to 2 Stripe objects: the subscription or PaymentIntent, plus the customer.

Your webhook: resolve the channel
// Inside your Stripe webhook handler, after stripe.webhooks.constructEvent()// Handle 2 events: ACH debits and other delayed methods fire the async one days laterconst paidEvents = ["checkout.session.completed", "checkout.session.async_payment_succeeded"]; if (paidEvents.includes(event.type)) {  const session = event.data.object;  if (session.payment_status === "unpaid") return; // delayed method: wait for the async event   const visit = await db.visits.findFirst(session.client_reference_id); // may be null  const metadata = {    channel: visit ? visit.source : "unknown", // your own label, e.g. "newsletter"    campaign: visit ? visit.campaign : "none",    cid: session.client_reference_id || "none",  };   // Renewals inherit subscription metadata; one-time sales use a guest customer,  // so the PaymentIntent is the object to write to there  if (session.mode === "subscription") {    await stripe.subscriptions.update(session.subscription, { metadata });  } else if (session.payment_intent) {    await stripe.paymentIntents.update(session.payment_intent, { metadata });  }  if (session.customer) {    await stripe.customers.update(session.customer, { metadata });  }}

Test locally with 1 command, stripe listen, from the Stripe CLI. The Buy Button docs and pricing table docs take the same reference as a client-reference-id attribute, with the same 200-character limit.

In practice, handle 2 events, checkout.session.completed and checkout.session.async_payment_succeeded, because ACH debits and other delayed methods confirm days later, per Stripe.

Method 3: What does a redirect page record?

A redirect page is a thank-you URL that records the Checkout Session and the UTM codes of one Payment Link sale. Set the confirmation behavior to redirect and put {CHECKOUT_SESSION_ID} in the URL.

Per Stripe's post-payment page, Stripe fills in the session ID and appends the link's UTM codes (up to 5), so your thank-you page gets both.

The page records a sale only if the buyer's browser loads it, and 2 buyers on one tagged URL look identical. For example, a buyer who closes the tab after paying never loads the page.

Your server can retrieve the Session by ID with a Stripe secret key and match the UTM codes to the paid order. The free UTM builder makes the URLs.

How do subscriptions, delayed payments and refunds change attribution?

A subscription renewal creates no Checkout Session, so client_reference_id sits only on the first payment: month 2 is an invoice.

Per the Invoice object reference, each invoice carries a snapshot of the subscription metadata taken at finalization, for invoices created on or after June 29, 2023 (in API version 2026-09-30 it sits at parent.subscription_details.metadata).

Write the channel to subscription metadata after payment 1.

Suppose 10 buyers from one newsletter take a $29 monthly plan for 12 months. That is 10 × $29 × 12 = $3,480, and the first payments are $290 of it, about 8%.

Crediting only the first charge makes the newsletter look 12 times smaller. The subscription LTV attribution guide reports lifetime revenue by channel.

Stripe says bank debits and vouchers can take 2 to 14 days to confirm, and a refund typically takes 5 to 10 business days to reach a statement.

Count revenue on a paid status in the Stripe Dashboard and drop it when you issue the refund.

TrackRev is SaaS affiliate software, and its pixel is the built-in tracking layer (Indie at $29 a month for 1 site, Growth at $299 a year for up to 10, October 2026).

We built the pixel to add its 36-character visitor ID as client_reference_id to every buy.stripe.com link and to Buy Button and pricing table embeds on pages where the pixel runs.

A read-only restricted Stripe key lets TrackRev find the Checkout Session behind each paid charge and credit the click behind that reference. With no ID, matching falls back to the email passed to identify().

The pixel sweeps links at load, at 3 timed intervals up to 2.5 seconds, and on click. Matching defaults to last touch with a 90-day window, and the visitor cookie lasts 1 year unless Safari's 7-day rule deletes it sooner.

SettingValue
Pixel link sweepsAt load, at 0.8, 1.5 and 2.5 seconds, and on click
Stripe sync and windowHourly poll, or seconds with the optional webhook; 90-day attribution window
Default modelLast touch; first touch and linear are 1 dropdown away
Renewals and refundsRenewals inherit the original click, and a refund removes the credit on the next sync
Visitor cookieWritten from JavaScript with a 1-year lifetime; Safari's 7-day rule can delete it sooner
Paid plans, all with Revenue AttributionIndie $29 a month (1 workspace, 1 tracked domain), Growth $299 a year (up to 10 workspaces, 10 tracked domains)
Free plan50 links and 1,000 tracked events a month, no revenue figures
Where it adds no IDLinks pasted into email, DMs or a bio, and links that already carry a client_reference_id

Source: our own pixel script and plan limits, October 2026.

When is your own webhook enough?

Your own webhook is enough when one product sells through 2 or 3 links. For example, a founder selling a $49 template pack through a newsletter link and a Google Ads link needs 2 links and no tool.

An existing webhook endpoint makes the visitor-ID method a few dozen lines plus a visits table.

In our experience building TrackRev, renewals, refunds and delayed payments are the harder part, and affiliates turn each one into a commission change, which is where a tool earns its price.

Checkout Sessions you create yourself take metadata at creation, and the Checkout attribution guide and metadata setup guide cover that route.

Found this useful? Share it.

PostLinkedIn

Frequently asked questions

Muzahid Maruf — Founder of TrackRev.io

Written by

Muzahid Maruf

Founder, TrackRev.io & Contant.io

Muzahid Maruf founded TrackRev.io, SaaS affiliate software with no limit on tracked revenue, and Contant.io. He writes about affiliate programs.

Writes about Marketing attribution · Link tracking · Revenue analytics · SaaS growth

Run your affiliate program without a revenue cap.

Affiliate software for indie hackers and small SaaS teams: $29 a month flat, 0% fees, link tracking and revenue attribution built in. Free to start, no card.