Revenue Attribution
Attribute revenue with Stripe Checkout API
Before proceeding, confirm that you have linked your Stripe account.
You no longer need to pass websiteId — Flowsery registers a dedicated webhook URL per website, so payments route to the correct site automatically.
To attribute a payment to the visitor's traffic source, forward the Flowsery cookies (_fs_vid and _fs_sid) into the Checkout Session metadata when you create the session server-side:
JavaScript
import { cookies } from 'next/headers';
const cookieStore = await cookies();
const session = await stripe.checkout.sessions.create({
line_items: [...],
mode: 'payment',
metadata: {
fs_visitor_id: cookieStore.get('_fs_vid')?.value,
fs_session_id: cookieStore.get('_fs_sid')?.value,
},
});Flowsery reads fs_visitor_id from the webhook and links the payment to that visitor's journey (referrer, channel, country, device).
Supported Stripe webhook events
checkout.session.completedinvoice.payment_succeededcharge.refunded
No metadata? Flowsery still attributes when it can
- Stripe Payment Links attribute automatically — the Flowsery script appends the visitor id as
client_reference_id. See Payment Links. - If you call
identify(email), Flowsery matches the payment to the visitor by email. - Otherwise the payment is still recorded as revenue, with an "Unknown" source.