Support/Revenue Attribution
Revenue Attribution

Attribute revenue with Stripe PaymentIntent API

Before proceeding, confirm that you have linked your Stripe account.

Use this guide for custom Stripe checkouts — the Payment Element, confirmCardPayment, or any flow where you create the PaymentIntent yourself. These never produce a Stripe Checkout Session, so there is no client_reference_id for the script to fill (that only works for Payment Links). You must forward the visitor cookie into the PaymentIntent metadata yourself — this is the only deterministic signal for this flow.

Flowsery processes these Stripe webhook events:

  • payment_intent.succeeded — emitted by custom PaymentIntent checkouts
  • checkout.session.completed
  • invoice.payment_succeeded
  • charge.refunded

Routing to the correct website is automatic (Flowsery registers a dedicated webhook URL per site) — you don't need to pass websiteId. To attribute the payment to the visitor's traffic source, forward the Flowsery cookies (_fs_vid / _fs_sid) as metadata when you create the PaymentIntent:

JavaScript
const paymentIntent = await stripe.paymentIntents.create({
  amount: 2000,
  currency: 'usd',
  metadata: {
    fs_visitor_id: req.cookies['_fs_vid'],
    fs_session_id: req.cookies['_fs_sid'],
  },
});

Flowsery reads fs_visitor_id from the payment_intent.succeeded webhook and links the payment to that visitor's journey (referrer, channel, country, device). Without it, the payment is still recorded as revenue but shows an "Unknown" source.

Fallback if you can't set metadata: call identify with the buyer's email (window.flowsery('identify', { userId: user.id, email: user.email })). Flowsery then matches the payment to the visitor by email.