FauryaFaurya
Revenue Attribution

LemonSqueezy Checkout API

Set up revenue attribution with LemonSqueezy Checkout API. Pass Faurya cookies as custom data for accurate marketing channel attribution.

Attribute revenue with LemonSqueezy Checkout API

Make sure you've connected your LemonSqueezy account first.

Pass custom with faurya_visitor_id and faurya_session_id (cookies from faurya) 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: {
          faurya_visitor_id: cookieStore.get('faurya_visitor_id')?.value,
          faurya_session_id: cookieStore.get('faurya_session_id')?.value
        }
      }
    }
  });
}

Once connected and custom data is properly passed, Faurya will automatically attribute revenue to the correct marketing channels. No webhook setup is required.

After receiving a successful payment, you should see revenue data in your dashboard (referrer, country, browser, etc.).

On this page