"Best analytics tool I've used in 14 years"

Payments API

Use the Payments API to send revenue events from any payment provider and attribute them to visitors.

If you use Stripe, LemonSqueezy, Polar, Paddle, Shopify, or WooCommerce through DataFast integrations, payments can be tracked automatically. Use this endpoint for custom payment flows or providers that DataFast does not integrate with yet.

EndpointMethodPathPurpose
Create paymentPOST/api/v1/paymentsRecord a payment or revenue event
Delete paymentsDELETE/api/v1/paymentsDelete payment events by transaction, visitor, or date range

Create a payment

POST https://datafa.st/api/v1/payments

Authentication

  • df_ website API key for one website. No websiteId query parameter required.
  • dft_ account token with payments:write. Pass websiteId as a query parameter.

Body parameters

FieldTypeRequiredDescription
amountnumberYesPayment amount. Must be zero or greater. Use refunded: true for refunds
currencystringYesPayment currency code, for example USD
transaction_idstringYesUnique transaction ID from your payment provider
datafast_visitor_idstringNoStrongly recommended for revenue attribution
email / customer_emailstringNoCustomer email
name / customer_namestringNoCustomer name
customer_idstringNoStable customer ID from your payment system
renewalbooleanNoSet true for recurring renewal payments
refundedbooleanNoSet true to record a refund
is_free_trialbooleanNoAlso inferred when amount is 0
timestampstringNoISO 8601 timestamp. Defaults to now
{
  "amount": 29.99,
  "currency": "USD",
  "transaction_id": "payment_456",
  "datafast_visitor_id": "visitor-id-from-cookie"
}

Delete payments

DELETE https://datafa.st/api/v1/payments

Delete by transaction_id, datafast_visitor_id, startAt, and endAt.
DELETE /api/v1/payments?transaction_id=payment_456
DELETE /api/v1/payments?datafast_visitor_id=visitor-id-from-cookie&startAt=2026-05-01T00:00:00Z&endAt=2026-05-19T23:59:59Z

Be careful: without a date range, matching records across all time can be deleted.

Response

Response fields

FieldTypeDescription
messagestringResult message. This endpoint does not wrap successful create responses in status: "success"
transaction_idstringTransaction ID that was recorded, attributed, skipped as duplicate, or refunded

✍️ Something missing? Suggest features.

🤖 AI agent or LLM? Read this page as markdown