Record a sale, its takings and its instalments
POST/api/sales-orders
One atomic call, the same shape the connected CRM's own receipt
endpoint takes: the lines, the money taken at the counter (payments)
and what is still owed (receivables) arrive together, because they are
one event. A three-request version leaves a window in which a sale
exists with no payments against it, and every report run in that window
is wrong.
payments + receivables may not exceed the sale's computed total —
the request is refused with ledger_exceeds_total rather than trimmed,
so the operator sees their slip while they can still fix it.
Created as a draft unless confirm is true. Requires sales.manage.
Request
Responses
- 201
- 422
Created.
buyer_required, ledger_exceeds_total, line_needs_name, line_needs_price, or line_currency_mismatch.