Attribute revenue with Paddle Checkout API
Make sure you've connected your Paddle account first.
Pass custom_data with datafast_visitor_id and datafast_session_id (cookies from DataFast) when creating a checkout transaction:
// 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 response = await fetch('https://api.paddle.com/transactions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${PADDLE_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
items: [...],
custom_data: {
datafast_visitor_id: cookieStore.get('datafast_visitor_id')?.value,
datafast_session_id: cookieStore.get('datafast_session_id')?.value
}
})
});
const data = await response.json();
return Response.json(data);
}
Once connected and custom data is properly passed, DataFast 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.