Attribute revenue with Polar Checkout API

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

Include metadata 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 result = await polar.checkouts.create({
    products: [...],
    metadata: {
      _fs_vid: cookieStore.get('_fs_vid')?.value,
      _fs_sid: cookieStore.get('_fs_sid')?.value,
    },
  });
}

Once connected and metadata 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.).