Skip to main content
POST

Authorizations

Authorization
string
header
required

An API key that starts with cs_sk_, created under API and MCP, API keys. A key covers every site of its workspace or a chosen list, and carries permissions per resource (Analytics, Revenue and payments, Goals and events, Funnels, Sites, Notes, Alerts) and extras (Visitor details, Raw events export, Team members, Workspace name, See API keys, Manage API keys). A change acts for the key's creator, with their current role. A request outside them answers 403 naming the missing permission.

Path Parameters

siteId
string
required

The site's id, from GET /sites. The demo site is read-only.

Body

application/json
transactionId
string
required

Your id for the payment, unique per site: an order, invoice or charge id. Sending the same id again records nothing new and answers duplicate: true. For a refund, the id of the sale being refunded.

Required string length: 1 - 200
amount
integer

Required for a payment: the amount in minor units of the currency (4900 is 49.00 USD), at least 1. For a refund, the amount refunded. With trial: true it may be 0 or left out; when sent, it is the price the trial converts to and is not counted as revenue.

Required range: 0 <= x <= 1000000000000
currency
string

Required for a payment: ISO 4217 currency code, such as USD. A refund is in its sale's currency. A trial needs it only with an amount.

Pattern: ^[A-Za-z]{3}$
visitorId
string

The visitor id from crispstats.id(), saved at checkout. Ties the payment to that visitor's visits and sources.

customerId
string

Your own id for the customer, the same id you pass to identify(). Attribution then also uses that person's visits.

Required string length: 1 - 200
email
string

The customer's e-mail. Stored only as a hash and a masked form (j***@e***.com); links renewals and refunds to the first payment.

Maximum string length: 320
product
string

What was bought, shown in the payments list.

Required string length: 1 - 200
renewal
boolean

true for a subscription renewal. Counted as renewal revenue and in MRR.

subscription
boolean

true for the first payment of a new subscription. Counted as new revenue and in MRR.

refunded
boolean

true to record a refund of the sale named by transactionId. It takes the sale's attribution.

trial
boolean

true to record a free trial start instead of a payment. It is attributed to the visitor's source like a sale, never counted as revenue, and converts when the same customer (customerId, email or visitorId) pays within 60 days.

refundId
string

Refunds only: your id for this refund. Send it when a sale can be refunded more than once by the same amount: without it, a second refund of the same amount on the same sale is taken as the first one sent again.

Required string length: 1 - 40
timestamp
string

When the payment happened, ISO 8601 with a timezone. Defaults to now. Up to 365 days back, never in the future.

Pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}:?\d{2})$

Response

Sent before: nothing new was recorded.

transactionId
string
required
recorded
boolean
required

Stored by this request.

duplicate
boolean
required

This transactionId (for a refund: this refund) was recorded before. Nothing changed.

linked
boolean
required

Tied to a visit, so the payment is credited to a source, campaign and landing page.

waitingForSale
boolean
required

A refund whose sale is not recorded yet. It is kept and counted once the sale arrives.

trial
boolean
required

A free trial start (trial: true), stored apart from revenue.