FauryaFaurya
Revenue Attribution

Stripe Checkout API

Track and attribute revenue in Faurya for Stripe Checkout API.

Faurya can automatically attribute revenue to sessions, campaigns, and sources by connecting your payment flow to your Faurya site. This guide shows the safest, most reliable way to do that with Stripe.

Attribute revenue with Stripe Checkout API

Make sure you've connected your Stripe account first.

Pass metadata 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 session = await stripe.checkout.sessions.create({
    line_items: [...],
    mode: 'payment',
    metadata: {
      faurya_visitor_id: cookieStore.get('faurya_visitor_id')?.value,
      faurya_session_id: cookieStore.get('faurya_session_id')?.value
    }
  });

  return new Response(JSON.stringify({ sessionId: session.id }), {
    status: 200,
    headers: { 'Content-Type': 'application/json' }
  });
}

Once connected and metadata 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.). If you don't, please contact us at marc@datafa.st.

On this page