Create a payment
POST https://datafa.st/api/v1/payments
Record a payment, refund, renewal, or free trial from a custom payment flow — for providers without a native DataFast integration or for payment links. Always include
datafast_visitor_id when possible so revenue is attributed to marketing channels.Successful responses use a plain JSON body (no
status wrapper). Duplicate transaction_id values are handled idempotently.Related: Revenue attribution · Custom payment API
Request
Query parameters
websiteIddft_ account token on Website API routes. Omit with a df_ website key. Example: ?websiteId=665f0b3c4d2e1a0012345678.Body parameters
amountrequired
29.99. Use 0 for free trials (or set is_free_trial: true).currencyrequired
"USD".transaction_idrequired
"txn_abc123". Re-posting the same ID returns a duplicate message, not a second payment.datafast_visitor_iddatafast_visitor_id cookie or tracking script. Example: "a3ab2331-989f-4cfa-91c6-2461c9e3c6bd". Alias: visitorId on some endpoints. Strongly recommended for revenue attribution.email / customer_emailemail or customer_email.name / customer_namecustomer_id"cus_abc123".renewalrefundedis_free_trialamount is 0. true for free trials. Also inferred when amount is 0.timestamp"2026-05-21T12:00:00Z".Example request body
{
"amount": 29.99,
"currency": "USD",
"transaction_id": "txn_abc123",
"datafast_visitor_id": "a3ab2331-989f-4cfa-91c6-2461c9e3c6bd",
"email": "customer@example.com"
}
Always include
datafast_visitor_id when possible so revenue is attributed to traffic sources.Response
Returns a plain JSON object. This endpoint intentionally does not wrap successful create responses in
status: "success".Response fields
messagestatus.transaction_idAuthentication
df_website API key: The website is inferred from the key. You do not need awebsiteIdquery parameter.dft_account token: Requirespayments:writepermission and?websiteId=on every request. The token must be allowed to access that website.
Read authentication and scopes for token creation, permission lists, and scoped tokens.
Errors
400 — Missing
amount, currency, or transaction_id, invalid amount, or invalid field combination.404 — Website not found.
See API errors for the standard error envelope, auth failures, validation errors, permission errors, and rate limits.