api-referencePOST
Automatic tracking available
If you use Stripe, LemonSqueezy, or Polar, you do not need this endpoint. Payments are tracked automatically when your payment provider is connected.POST
https://analytics.flowsery.com/analytics/api/v1/paymentsRecord a payment and attribute revenue. Send amount plus any identifiers you have, especially transactionId and visitorUid/sessionUid when available.
Bearer Token (workspace token or website API key)
Workspace tokens need a website selector
Workspace API tokens can access every website in the workspace. Pass either <code>websiteId</code> or <code>domain</code> so Flowsery knows which website to query or mutate. Website API keys are already scoped to one website, so the selector can be omitted.Website selector
| Parameter | Type | Description |
|---|---|---|
websiteId | string | Website ID to use with a workspace API token. Include this field in the JSON body unless you provide domain. Omit when authenticating with a website API key. |
domain | string | Website domain to use with a workspace API token when websiteId is not provided. Include this field in the JSON body. Omit when authenticating with a website API key. |
Request body
| Parameter | Type | Description |
|---|---|---|
amount | number | Payment amount. This should always be sent. |
currency | string | Currency code such as "USD", "EUR", "GBP". |
transactionId | string | Stable transaction identifier used for deduplication. |
visitorUid | string | Optional Flowsery visitor ID, typically sourced from the _fs_vid cookie on your own backend. |
sessionUid | string | Optional Flowsery session ID, typically sourced from the _fs_sid cookie. |
email | string | Customer email address. |
name | string | Customer name. |
customerId | string | Customer ID from your payment provider. |
isRenewal | boolean | Set to true for recurring payments. Defaults to false. |
isRefund | boolean | Set to true for refunded payments. Defaults to false. |
The success payload contains a confirmation message only.
Example request (Node.js)
const handler = async (req, res) => {
const _fs_vid = req.cookies._fs_vid;
const _fs_sid = req.cookies._fs_sid;
const response = await fetch(
"https://analytics.flowsery.com/analytics/api/v1/payments",
{
method: "POST",
headers: {
Authorization: `Bearer ${FLOWSERY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
websiteId: process.env.FLOWSERY_WEBSITE_ID,
amount: 29.99,
currency: "USD",
transactionId: "payment_456",
visitorUid: _fs_vid,
sessionUid: _fs_sid,
email: "buyer@example.com",
}),
}
);
res.status(200).send("Payment tracked");
};200
{
"status": "success",
"data": [{
"message": "Payment recorded successfully"
}]
}