Attribute Stripe payments to the right link
Carry the CodeQR click id into Stripe Checkout so a completed payment is credited to the link or QR code that produced it, without writing tracking code.

Checkout happens on Stripe's domain, so the click id has to travel with the customer. CodeQR does that through Stripe's own client_reference_id, which means a payment can be credited to a link without you writing tracking code.
Availability
- Plan: Pro and above, or the 14-day trial.
- Where: Settings → Integrations → Stripe, plus the script on your site.
Before you start
- Conversion tracking on for the link or QR code — Set up conversion tracking on your website.
- The CodeQR script installed, so the
cq_idcookie exists on your site. - A Stripe account you can connect.
Steps
- Open Settings → Integrations, find Stripe under Payments and connect it.
- On your site, append
?codeqr_client_reference_id=1to the Stripe checkout link:
<a href="https://buy.stripe.com/xxxxxxxx?codeqr_client_reference_id=1">Buy now</a>
- When a visitor selects it, CodeQR rewrites that parameter into Stripe's
client_reference_id, carrying the click id into the session. - When the payment completes, Stripe notifies CodeQR and the sale is attributed.
Nothing else is required: you do not call the API, and you do not have to store the click id yourself.
If you build the checkout session in code
Set client_reference_id yourself, in the format CodeQR reads:
const session = await stripe.checkout.sessions.create({
mode: 'payment',
line_items: [{ price: 'price_123', quantity: 1 }],
client_reference_id: `codeqr_id_${clickId}`,
success_url: 'https://example.com/thanks',
})clickId is the value of the cq_id cookie on your site.
Stripe accepts only letters, digits, - and _ in that field, up to 200 characters, and discards anything else without an error. The codeqr_id_… shape stays inside those rules; a value carrying an e-mail address or a URL does not, and the payment then arrives with no origin at all.
What gets recorded
A completed payment creates a sale attributed to the click, with the amount and currency Stripe reports. If the customer had no lead before, one is created so the chain stays intact.
Other payment platforms
The same idea applies elsewhere, with a different field name. Kiwify has its own integration under Payments. For everything else — Hotmart, Eduzz, Nuvemshop, a homegrown checkout — send the sale from your server once the payment is confirmed, as in Send lead and sale events from your server.
Verify it works
Run one real, small payment through the flow and check the link:
curl -sS "https://api.codeqr.io/links/info?domain=go.example.com&key=summer" \ -H "Authorization: Bearer codeqr_xxxxxxxxxxxxxxxxxxxxxxxx"
{ "key": "summer", "clicks": 1, "leads": 1, "sales": 1, "saleAmount": 4990 }Then open Customers: the buyer appears with a timeline ending in the purchase.
Troubleshooting
The payment went through and no sale was recorded
Check client_reference_id on the Stripe session. If it is empty, the parameter never reached Stripe — usually because the checkout link was opened from a page the visitor reached without a tracked link, or because your site strips unknown parameters.
client_reference_id is set but has the wrong shape
Stripe drops values with characters outside letters, digits, - and _. Anything CodeQR cannot parse as codeqr_id_<clickId> is ignored.
The sale is attributed to the wrong campaign
The click id in the browser is the earliest one inside the window. How CodeQR decides which click gets the sale explains the rule.
The customer paid weeks after clicking
That works as long as the click was inside the thirty-day window and the cookie survived. Safari and ad blockers shorten it in practice — see Fix conversions that are not being recorded.