API reference

Payments API

Record a payment, renewal or refund with POST /api/v1/payments and attribute it to the visitor's visits: every field, examples and responses.

POST https://supranalytics.app/api/v1/payments

Records a payment and attributes it to the visitor's visits. For providers without a built-in webhook; see Revenue attribution.

Body

FieldTypeDescription
amountnumber, requiredIn major units: 29.99, not 2999. 0 or more.
transaction_idstring, requiredYour id for the payment. Sending it again updates the same payment instead of adding one.
currencystringISO code, like USD or EUR. Defaults to the website's currency.
visitor_idstringThe supr_visitor_id cookie. Also accepted as supr_visitor_id.
session_idstringThe supr_session_id cookie, to credit that exact visit. Also supr_session_id.
emailstringThe customer's email. Matches the visitor when there's no visitor_id.
namestringThe customer's name.
customer_idstringYour customer id. Later payments with it are credited to the same visitor.
renewalbooleantrue for a subscription renewal (counted as revenue, not as a new customer).
refundedbooleantrue marks the payment with this transaction_id as refunded.
timestampstring or numberWhen it was paid (ISO date or milliseconds). Defaults to now.
providerstringA label for where it came from, like paddle. Defaults to api.

Examples

curl -X POST https://supranalytics.app/api/v1/payments \
  -H "Authorization: Bearer pk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 29.99, "currency": "USD", "transaction_id": "order_123", "visitor_id": "6f1c2a9e-…", "email": "ada@example.com"}'

Responses

StatusBody
200{ "ok": true, "visitorId": "…", "attributed": true, "duplicate": false }
200 (refund){ "ok": true, "refunded": "<payment id>" }
400{ "error": "transaction_id is required" }

attributed says whether the payment was tied to a visit; duplicate that the transaction was already known (retries are safe).

AI agent or LLM? Read this page as Markdown