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

Create a payment

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

Record a payment, refund, renewal, or free trial from a custom payment flow.

Request

Authentication

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

Body parameters

FieldTypeRequiredDescription
amountnumberYesPayment amount sent by your payment system. DataFast converts it for reporting when needed.
currencystringYesCurrency code for money values, such as USD or EUR.
transaction_idstringYesUnique transaction ID from your payment provider. Used for idempotency and deletion.
datafast_visitor_idstringNoDataFast visitor UUID from the browser cookie or client SDK. Used to attach server-side events to a visitor journey. Visitor UUID. Strongly recommended for attribution.
email / customer_emailstringNoCustomer email.
name / customer_namestringNoHuman-readable name for the resource or event. The exact meaning depends on the endpoint.
customer_idstringNoStable customer ID from your payment system. Helps connect payments and free trials to the same customer.
renewalbooleanNoWhether the payment is a recurring renewal. This affects lifecycle and renewal revenue reporting.
refundedbooleanNoWhether this payload represents a refund instead of a payment.
is_free_trialbooleanNoWhether this payload represents a free trial. Also inferred when amount is 0.
timestampstringNoEvent timestamp. Use it when recording historical events; defaults to the request time.

Response

Returns a plain JSON object. This endpoint intentionally does not wrap successful create responses in status: "success".

Response fields

FieldTypeDescription
messagestringHuman-readable confirmation or status message for the operation. Result message. This endpoint does not wrap create responses in status.
transaction_idstringUnique transaction ID from your payment provider. Used for idempotency and deletion. Transaction ID that was recorded, skipped, refunded, or attributed.

Errors

Common errors include 400 for invalid input, 401 for missing or invalid tokens, 403 for missing permission or suspended tracking, 404 for missing resources, and 500 for server errors.

✍️ Something missing? Suggest features.

🤖 AI agent or LLM? Read this page as markdown

Example request
curl -X POST "https://datafa.st/api/v1/payments" \
  -H "Authorization: Bearer df_xxx" \
  -H "Content-Type: application/json" \
  -d '{"amount":29.99,"currency":"USD","transaction_id":"payment_456","datafast_visitor_id":"visitor-id-from-cookie"}'
Success response
{
  "message": "Payment recorded and attributed successfully",
  "transaction_id": "payment_456"
}