Record a sale
Charge -> sale -> commission -> balance, atomically, through the same writer the processor webhooks use. Idempotent on external_charge_id: sending the same charge twice returns the same sale with a 200 instead of a 201. amount_minor is gross; tax is subtracted before the rate when the program commissions on net revenue. The response says explicitly whether money followed: activity_outcome is commission_created or sale_recorded, and a sale that paid nobody carries machine-readable warnings instead of failing the call. Customer auto-enrol runs on processor webhooks, not on this endpoint. Charge ids are unique per program, so another program using the same id never affects yours. A charge id already recorded in your program in the other mode (a test-mode id sent with a live key, or the reverse) answers 409 external_charge_id_taken with no sale fields.
Scope: commissions:write (or write)
Request
- Base URL: https://api.affiliaterail.com
- URL: https://api.affiliaterail.com/v1/sales
- Auth: HTTP bearer
Request body
Example request
{
"program_id": "prg_7uSyy9FqVLCFWrdPeZaK",
"customer_id": "cus_7uSyy9FqVLCFWrdPeZaK",
"amount_minor": 2500,
"tax_minor": 2500,
"currency": "USD",
"occurred_at": "2026-08-21T10:15:30.000Z"
}Response
Already recorded: the existing sale
Example response
{
"id": "sale_7uSyy9FqVLCFWrdPeZaK",
"program_id": "prg_7uSyy9FqVLCFWrdPeZaK",
"customer_id": "cus_7uSyy9FqVLCFWrdPeZaK",
"partner_id": "part_7uSyy9FqVLCFWrdPeZaK",
"amount_minor": 2500,
"tax_minor": 2500,
"currency": "USD",
"occurred_at": "2026-08-21T10:15:30.000Z",
"refunded_at": "2026-08-21T10:15:30.000Z",
"created_at": "2026-08-21T10:15:30.000Z",
"updated_at": "2026-08-21T10:15:30.000Z"
}Changes
No recorded changes to this operation across all 1 revision of this API.