Track Server-Created Stripe Checkout
When your server creates a Stripe Checkout Session, pass the actual Attriboo visitor ID from the permitted website visit into that session. The payment connection then has a reference it can match with a recorded visitor.
Instructions reviewed
Send the visitor reference to your own server
Install and verify the standard tracker first. Read window.attriboo.getVisitorId() in the browser after the site's consent requirements are met, then send that value to your existing checkout endpoint. It is a visitor reference, not authentication or proof of a purchase. Your server still authenticates the customer and validates products, prices and permissions.
If no ID is available, continue your ordinary checkout without fabricating a reference or bypassing consent. An unmatched payment is more accurate than assigning it to the wrong person.
const attribooVisitorId = window.attriboo?.getVisitorId?.() || null;
// Include this value in the body sent to your existing, authenticated checkout endpoint.
// Keep Stripe and Attriboo private keys on the server.Attach the reference to the Checkout Session
On your server, preserve the Checkout Session options your application already validates. Add metadata.attriboo_visitor_id when a valid visitor reference is supplied. If you are not using client_reference_id for another purpose, that field is another supported matching route.
The following fragment belongs inside your existing Stripe integration. It is not a complete checkout endpoint. Keep the selected price, amount, product access and redirect URLs under server control.
const options = { ...validatedCheckoutOptions };
if (typeof attribooVisitorId === 'string' && attribooVisitorId.length <= 64) {
options.metadata = {
...options.metadata,
attriboo_visitor_id: attribooVisitorId,
};
}
const session = await stripe.checkout.sessions.create(options);Check payments, subscriptions and gaps
Connect Stripe to the same Attriboo website. Verify one known completed Checkout Session and its matching visit. References unknown to that website are ignored rather than inventing visitor history.
For Stripe Billing, paid invoices can represent a first subscription payment or a renewal. Where the customer was matched earlier, later invoices and refunds can follow that buyer. Check the first payment and its customer linkage before assuming renewals have a source.
This does not add support for standalone PaymentIntents outside Checkout or Billing. Importing older payments cannot recreate a missing visit. Dates, currencies and supported records still matter.
You are done when
Your checkout preserves business identifiers and supplies the actual visitor reference through a supported Stripe field.
Still need a hand?
Send a question without needing to sign in.