Skip to main content

Stripe

Payment Links

A link you share has no server call — the visitor comes back to your site instead.

Use this when you sell through a Stripe Payment Link and write no server code of your own: a link in an e-mail, a button on a landing page, a QR code.

There is nowhere to set metadata, because you never create the session. What there is instead is the customer coming back to your site afterwards.

Setting it up

In Stripe, open the payment link and under After payment choose to redirect to your own page. Add session_id to the URL:

https://yoursite.com/thank-you?session_id={CHECKOUT_SESSION_ID}

Stripe replaces {CHECKOUT_SESSION_ID} with the real id. Our script reads it when the visitor lands back on your site and joins the payment to that visit — no code from you beyond having the script on the page.

The {CHECKOUT_SESSION_ID} braces are literal. Type them exactly as written; Stripe substitutes the value. Replacing them with an id of your own attributes every payment to the same session.

What this cannot do

It attributes the first payment only. The redirect happens once, when the customer buys. Renewals are charged without anyone visiting your site, so there is no page load to read anything from — those payments arrive unattributed.

It needs the customer to come back. A visitor who closes the tab on Stripe's confirmation page never reaches your success URL, and that payment stays unattributed even though it succeeded.

If you sell subscriptions, prefer the Checkout Session: metadata set there carries onto every renewal for the life of the subscription, without the customer having to do anything.

Was this page helpful?

Last updated September 8, 2026

Payment Links | TrueStat | NookDocs