Transaction fields
The fields of a payment source's transaction reports and responses, and the errors they return.
A payment source reports each payment and refund with PUT on its Transactions endpoint,
under an ID that's unique within the source. See Report a payment.
Request
| Field | Meaning |
|---|---|
type | charge for a payment, refund to return money. |
distinctId | The person's distinct ID. |
customer.externalId | Your source's ID for the customer, when you have no distinct ID. |
productKey | The mapped product key. Charges only. |
amount | What the customer paid, tax included, in minor units (4900 is 49.00). |
currency | ISO 4217 code, such as EUR. Analytics converts it to USD at the day's rate. |
fee | Optional. The source's commission, so proceeds are what you receive. |
tax | Optional. The tax included in amount. |
occurredAt | When the customer paid. Revenue is dated by it. |
subscriptionId, periodStart, periodEnd | For a subscription payment: the subscription and the period it pays for. |
refundsTransactionId | For a refund: the ID of the charge it returns money from. |
environment | Optional. production or test; must match the key, or the request is rejected. |
A charge without subscriptionId completes a one-time purchase.
Response
The response is the recorded transaction:
| Field | Meaning |
|---|---|
id, paymentProviderId, type | Your ID, the source, and charge or refund. |
status | applied once recorded, or pending while it waits. |
pendingReason | product_not_mapped (map the product key) or charge_not_recorded (report the charge a refund or subscription refers to). null when applied. |
purchaseId | The Voidhash purchase it belongs to, once applied. |
bookedAmount | What it recorded. A refund books less than its amount when less was left of the charge. |
Errors
A rejected request records nothing and doesn't use up its ID.
| Code | Type | Meaning |
|---|---|---|
transaction_conflict | conflict | The ID is recorded with other content. Retrying can't help. |
invalid_transaction | invalid_request | The payment breaks a rule, such as a refund in another currency. |
invalid_subscription | invalid_request | The subscription state can't be recorded as sent. |
payment_source_required | invalid_request | The payment provider ID names a store, not a payment source. |
payment_provider_not_found | not_found | The project has no payment provider with that ID. |
payment_source_disabled | conflict | The source is disabled in Studio. |
See Errors for the error format and every type, and Retries and corrections for when to resend.
Next steps
- Payment sources: set up a source and report payments.
- Report subscriptions: subscription payments and state.
- Build a provider endpoint: import products and history.
Something wrong or missing on this page? Tell us by email or on Discord.