Insert a payment for an invoice
Record a payment against an invoice. On success the invoice's paid_amount, remaining_amount, and payment status are recomputed to reflect the new payment.
The recorded amount is capped at the invoice's outstanding balance (its remaining_amount): only the portion up to that balance is applied to the invoice, and any excess becomes a customer credit for the account. In the response, the payment's amount holds the applied (capped) portion and the generated credit appears in overpayment_credits with the excess as its amount. On the invoice, paid_amount grows by the applied portion only, so it ends equal to total, remaining_amount drops to 0, and status becomes FULLY_PAID — an overpayment never produces OVER_PAID. For example, sending an amount of 150 against an invoice with a remaining_amount of "100.00" returns a payment with amount "100" and one entry in overpayment_credits with amount "50"; the invoice then reads paid_amount equal to total, remaining_amount "0.00", and status FULLY_PAID. A payment cannot be filed against an invoice that is already fully paid, or against a voided invoice — both are rejected. Returns 404 when the invoice does not exist in the caller's company, and 403 when the API key's user cannot see it under their team restrictions.
If the company is connected to QuickBooks Online there are two extra behaviors. First, Distru synchronously pulls the latest payment and credit data from QuickBooks Online before recording, which can briefly fail with a "try again in a few seconds" error while that refresh runs — retry the request in that case. Second, the payment (or its invoice) is only queued for sync to QuickBooks Online once its dependencies are already synced there; otherwise the sync is deferred. A 200 is therefore not confirmation the payment reached QuickBooks Online — the response's quickbooks_sync_enqueued flag tells you whether a sync was queued, and you should poll QuickBooks Online to observe the final result. The payment may also be pushed to LeafLink when that integration is configured for the customer.
Required permission: invoices_permissions_receive_payment. The authenticated user must also be allowed to view invoices under their team restrictions.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Path parameters
The id of the invoice to record the payment against — the id returned by the list and show invoice endpoints.
Request body
Response
A single payment
Example response
{
"data": {
"company": {
"id": "3f128a34-cc59-4b49-8883-23bf10e59c6c",
"name": "Retailer 1"
}
}
}Changes
No recorded changes to this operation across all 17 revisions of this API.