Revenue Attribution
Attribute revenue with custom payment providers
If you already use a connected provider such as Stripe, Paddle, LemonSqueezy, or Polar, prefer that built-in integration first.
Choose the right API credential
For most custom payment-provider integrations, use a website API key from the website's Settings > API page. Website keys start with flow_ and are already scoped to that one website.
Use a workspace API token from the workspace API Tokens page only when a shared backend, MCP integration, or automation needs access to multiple websites. Workspace tokens start with flow_ws_. When you use one, include websiteId or domain in the request body so Flowsery knows which website should receive the payment.
Send payments with the current API contract
When a payment succeeds, call the Flowsery Payment API:
JavaScript
await fetch('https://analytics.flowsery.com/api/v1/payments', {
method: 'POST',
headers: {
Authorization: `Bearer ${FLOWSERY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
// Required only when FLOWSERY_API_KEY is a workspace token.
websiteId: process.env.FLOWSERY_WEBSITE_ID,
amount: 29.99,
currency: 'USD',
transactionId: 'txn_98hj',
visitorUid: request.cookies._fs_vid,
sessionUid: request.cookies._fs_sid,
email: 'buyer@example.com',
name: 'Buyer Name',
customerId: 'cus_123',
}),
});Notes
- Use the backend field names exactly:
visitorUid,sessionUid, andtransactionId. websiteIdordomainis required forflow_ws_workspace tokens and optional forflow_website API keys.amountshould always be sent.- Deduplication is based on
transactionId. - Refunds should reuse the original
transactionIdand setisRefund: true.
For the endpoint details, see Create Payment.