Support/Revenue Attribution
Revenue Attribution

Attribute revenue with Dodo Payments

Before proceeding, confirm that you have installed the Flowsery tracking script.

1. Store the Flowsery visitor ID with the checkout

If you have access to the Flowsery cookies, capture _fs_vid and optionally _fs_sid when the checkout session is created so you can forward them later as visitorUid and sessionUid.

2. Create a Flowsery API credential

Generate a website API key from the website's Settings > API page. Website keys start with flow_ and are already scoped to one website, which is the simplest option for this payment webhook.

If you use a workspace API token from API Tokens instead, it starts with flow_ws_ and can access every website in the workspace. Include websiteId or domain in the Payment API payload when using a workspace token.

3. Forward successful payments to the Flowsery Payment API

JavaScript
function handler(webhook) {
  if (webhook.eventType !== 'payment.succeeded') {
    return null;
  }
 
  const payment = webhook.payload.data;
 
  webhook.url = 'https://analytics.flowsery.com/api/v1/payments';
  webhook.payload = {
    // Required only when you authenticate with a workspace token.
    websiteId: process.env.FLOWSERY_WEBSITE_ID,
    amount: payment.total_amount / 100,
    currency: payment.currency,
    transactionId: payment.payment_id,
    visitorUid: payment.metadata?._fs_vid,
    sessionUid: payment.metadata?._fs_sid,
    email: payment.customer?.email,
    name: payment.customer?.name,
    customerId: payment.customer?.id,
  };
 
  return webhook;
}

Use the Flowsery Payment API field names exactly. _fs_vid by itself is just where you may source visitorUid; it is not the API field name.