If you use Stripe, LemonSqueezy, or Polar, this endpoint is unnecessary. Payments are tracked automatically once you have connected your payment provider.

Attribute revenue with custom payment providers

Use the Flowsery Analytics Payment API to record payments and attribute revenue to your traffic sources.

How it works

When a successful payment is received, make an API call to the Flowsery Analytics Payment API. That is all that is needed.

// Send payment data to the Flowsery Analytics API
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',
    transaction_id: 'txn_98hj',
    _fs_vid: '3cff4252-fa96-4gec-8b1b-bs695e763b65', // available in the cookie, like request.cookies._fs_vid
  }),
});

You will need an API key for your website.

Here is the recommended flow:

  1. Capture the Flowsery Analytics visitor ID, a unique identifier for each visitor, from the _fs_vid cookie. Store it in your database or pass it to your payment provider when creating checkout sessions (metadata).
  2. Send payment data to Flowsery Analytics via the Payment API when a successful payment arrives (your webhook handler, a success page, etc.)

For additional details, see the Payment API documentation.