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

Canonical page: https://www.attriboo.com/docs/payments/stripe-checkout

Instructions reviewed: 2026-10-31

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

Read the visitor reference in your existing browser checkout handler

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

Add metadata while preserving your existing Checkout Session options

```
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);
```

- [Stripe's Checkout Session creation reference](https://docs.stripe.com/api/checkout/sessions/create)

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

- [Read the payment-connection history limits](https://www.attriboo.com/docs/payment-connections)
- [Investigate missing sales](https://www.attriboo.com/docs/troubleshooting/missing-sales)

## You are done when

Your checkout preserves business identifiers and supplies the actual visitor reference through a supported Stripe field.

## Related guides

- [Track Stripe Payment Links](https://www.attriboo.com/docs/markdown/payments/stripe-payment-links.md)
- [Connect your payment provider](https://www.attriboo.com/docs/markdown/payment-connections.md)
- [Understand recorded revenue](https://www.attriboo.com/docs/markdown/revenue.md)
- [Read Attriboo reports through the API](https://www.attriboo.com/docs/markdown/api.md)
