Create a payment
POST https://datafa.st/api/v1/paymentsRecord 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
websiteIdstring
Required with a
dft_ account token on Website API routes. Omit with a df_ website key. Example: ?websiteId=665f0b3c4d2e1a0012345678.Body parameters
amountnumber
required
Amount in major currency units. Example:
29.99. Use 0 for free trials (or set is_free_trial: true).currencystring
required
ISO currency code matching your charge. Example:
"USD".transaction_idstring
required
Unique ID from your billing system — used for idempotency. Example:
"txn_abc123". Re-posting the same ID returns a duplicate message, not a second payment.datafast_visitor_idstring
Visitor UUID from the
datafast_visitor_id cookie or tracking script. Example: "a3ab2331-989f-4cfa-91c6-2461c9e3c6bd". Alias: visitorId on some endpoints. Strongly recommended for revenue attribution.email / customer_emailstring
Customer email. Helps match free trials to later payments. Accepts
email or customer_email.name / customer_namestring
Human-readable name for the resource or event. The exact meaning depends on the endpoint.
customer_idstring
Stable customer ID from your billing system. Example:
"cus_abc123".renewalboolean
Whether the payment is a recurring renewal. This affects lifecycle and renewal revenue reporting.
refundedboolean
Whether this payload represents a refund instead of a payment.
is_free_trialboolean
Whether this payload represents a free trial. Also inferred when
amount is 0. true for free trials. Also inferred when amount is 0.timestampstring
ISO 8601 event time. Defaults to request time. Example:
"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
messagestring
Human-readable confirmation or status message for the operation. Result message. This endpoint does not wrap create responses in
status.transaction_idstring (optional)
Unique transaction ID from your payment provider. Used for idempotency and deletion. Transaction ID that was recorded, skipped, refunded, or attributed. Two successful payment branches currently return only
message: an existing payment event, or a missing first visitor event.Authentication
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.