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.
POSThttps://analytics.flowsery.com/api/v1/payments

Record 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

ParameterTypeDescription
amountnumberPayment amount. This should always be sent.
currencystringCurrency code such as "USD", "EUR", "GBP".
transactionIdstringStable transaction identifier used for deduplication.
visitorUidstringOptional Flowsery visitor ID, typically sourced from the _fs_vid cookie on your own backend.
sessionUidstringOptional Flowsery session ID, typically sourced from the _fs_sid cookie.
emailstringCustomer email address.
namestringCustomer name.
customerIdstringCustomer ID from your payment provider.
isRenewalbooleanSet to true for recurring payments. Defaults to false.
isRefundbooleanSet 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"
  }]
}