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/api/v1/paymentsRecord a payment and attribute revenue. Send amount plus any identifiers you have, especially transactionId and visitorUid/sessionUid when available.
Bearer Token (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/api/v1/payments",
{
method: "POST",
headers: {
Authorization: `Bearer ${FLOWSERY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
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"
}]
}