Payments API
For payment sources without a built in integration. Create a key under Integrations. Keys are shown once, can be limited to one website, and have scopes: payments:write, payments:read, goals:write, crawlers:write, and stats:read for AI assistants. A key with no scopes chosen gets every scope except stats:read.
Record a payment
curl -X POST https://datafair.dev/api/v1/payments \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"website_id": "PUBLIC_SITE_ID",
"transaction_id": "order_8214",
"amount_minor": 2900,
"currency": "USD",
"visitor_id": "VALUE_OF_df_vid_COOKIE",
"email": "buyer@example.com",
"subscription_id": "sub_1042",
"timestamp": "2026-10-31T12:00:00Z"
}'website_id: required unless the key is limited to one websitetransaction_id: required, and your idempotency key. Retrying the same id doesn't count twiceamount_minor: integer minor units, such as cents. Oramountas a decimal string, such as "29.00"refunded: true records the total refunded so far on that transactionsubscription_id: optional. Payments that share one count as a subscription in recurring revenue and churn, credited to the source the first payment came from
Look up a payment
curl https://datafair.dev/api/v1/payments/order_8214?website_id=PUBLIC_SITE_ID \
-H "Authorization: Bearer YOUR_API_KEY"Record a server side goal
curl -X POST https://datafair.dev/api/v1/goals \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"website_id":"PUBLIC_SITE_ID","visitor_id":"VISITOR_ID","name":"signup","idempotency_key":"signup-12345"}'Errors
400 invalid input. 401 missing or invalid key. 403 key lacks the scope. 404 not found. 429 monthly event limit reached (goals only).