Best analytics tool I've used in 14 years

Revenue attribution guide

If you're using Stripe, LemonSqueezy, or Polar, you don't need to use this endpoint. We automatically track payments if you have connected your payment provider.

Attribute revenue with custom payment providers

Use DataFast's Payment API to create payments and attribute revenue to your traffic sources.

How it works

When you receive a successful payment, make an API call to DataFast's Payment API. That's it!

// Send payment data to DataFast's API
await fetch('https://datafa.st/api/v1/payments', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${DATAFAST_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    amount: 29.99,
    currency: 'USD',
    transaction_id: 'txn_98hj',
    datafast_visitor_id: '3cff4252-fa96-4gec-8b1b-bs695e763b65', // available in the cookie, like request.cookies.datafast_visitor_id
  }),
});

You'll need an API key for your website.

Here's a recommended flow:

  1. Capture DataFast's visitor ID, a unique identifier for each visitor, from the cookie datafast_visitor_id. Store it in your database or pass it to your payment provider when creating checkout sessions (metadata).
  2. Send payment data to DataFast using our Payment API when you receive a successful payment (your webhook handler, a success page, etc.)

For more details, see the Payment API documentation.

Something missing? Suggest features ✍️