Skip to main content
Stripe sends payments, subscriptions, invoices, refunds, and disputes to Datalyr. Add the Datalyr visitor ID to Stripe objects so the payment can be linked to the exact web journey.

Connect Stripe

1

Open Sources

Find Stripe and select Connect.
2

Authorize the account

Complete Stripe Apps OAuth and choose the Stripe account used by this workspace.
3

Link web visitors

Follow the setup dialog that opens after authorization. Choose the snippet matching your Stripe integration.
4

Run one payment

Use the supported Stripe test or live flow and verify the resulting event in Datalyr.
No manual Stripe webhook endpoint is required for the current OAuth connection.

Checkout Sessions

Get the current Datalyr identity in the browser:
const datalyrStripe = datalyr.getStripeMetadata()
// { client_reference_id, metadata: { visitor_id } }
Pass it when your server creates the Checkout Session:
const session = await stripe.checkout.sessions.create({
  ...datalyrStripe,
  mode: 'subscription',
  line_items: [{ price: 'price_123', quantity: 1 }],
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/pricing'
})
The completed Checkout Session uses client_reference_id for deterministic attribution.

PaymentIntents

const visitorId = datalyr.getVisitorId()

await stripe.paymentIntents.create({
  amount: 9900,
  currency: 'usd',
  metadata: { visitor_id: visitorId }
})

Subscriptions

Add metadata.visitor_id to the Subscription. Subscription metadata propagates into the supported invoice flow so later renewals remain associated with the original customer identity.
await stripe.subscriptions.create({
  customer: 'cus_123',
  items: [{ price: 'price_123' }],
  metadata: { visitor_id: visitorId }
})
The current Web SDK automatically decorates supported buy.stripe.com Payment Links and Stripe pricing-table or buy-button embeds. It adds the visitor reference without requiring custom checkout code. Do not append unsupported parameters to already-created checkout.stripe.com Session URLs.

What appears in Datalyr

Stripe reporting includes revenue, purchases, conversions, net revenue, refunds, disputes, and subscription lifecycle metrics such as new and cancelled subscriptions when present in the source data.

Verify attribution

  1. Open the website in a private window with test UTMs.
  2. Confirm the pageview event and visitor ID.
  3. Complete a Stripe test payment through the same integration path used in production.
  4. Find the Stripe event and confirm value, currency, customer, and transaction identifiers.
  5. Open the customer journey and confirm the web visit precedes the payment.
Email matching is a fallback, not the preferred implementation. Use client_reference_id or metadata.visitor_id whenever you control Stripe object creation.