Attribute revenue with LemonSqueezy Checkout API
Before proceeding, confirm that you have linked your LemonSqueezy account.
Include custom with _fs_vid and _fs_sid (cookies set by Flowsery Analytics) when creating a checkout session:
// app/api/create-checkout/route.js
import { cookies } from 'next/headers';
export async function POST() {
const cookieStore = cookies();
// If you're using Next.js 15+, use this instead:
// const cookieStore = await cookies();
const { data, error } = await createCheckout({
storeId,
variantId,
{
productOptions: { ... },
checkoutData: {
...,
custom: {
_fs_vid: cookieStore.get('_fs_vid')?.value,
_fs_sid: cookieStore.get('_fs_sid')?.value
}
}
}
});
}
Once connected and custom data is passed correctly, Flowsery Analytics will automatically attribute revenue to the appropriate marketing channels. No webhook configuration is needed.
Following a successful payment, revenue data should appear in your dashboard (referrer, country, browser, etc.).