Records a payment against an invoice and applies it immediately.
POST /accounting/invoices/{id}/pay
Group: Accounting › Invoices · Operation ID: payInvoice
Records a payment against one invoice and applies it immediately. The invoice is named by the :id path segment. The response contains the id of the payment created.
This is a settlement, not a bookkeeping note. A payment record is created against the invoice's customer and entity, applied to the invoice, and posted to the ledger against the entity's default receivable account. Read the invoice back with GET accounting/invoices/:id to see the reduced totalAmountDue and the increased paymentsApplied, or read the payment with GET accounting/payments/:id.
The amount is in the invoice's currency and must be greater than zero. An over-payment is refused with AMOUNT_EXCEEDS_DUE, whose details contain the amount still outstanding. A partial payment is accepted and is the normal case for installments. Call the endpoint again for each one.
bankFeeAmount is what the bank or processor deducted. It is recorded on the payment rather than subtracted from it. Send the gross amount the customer paid in amount, and the fee beside it.
Send an Idempotency-Key header. A retry carrying the same key and body replays the original response instead of recording a second payment, so a timed-out call is safe to retry. Without the header, a retried call that had in fact succeeded records a second payment.
The call runs in one transaction. A failure writes neither the payment nor its application.
Open in the interactive reference
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Api-Version |
header | "v1" |
yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1. |
Idempotency-Key |
header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored. |
id |
path | string | yes | The unique identifier for the invoice to settle. |
Request body
Required, application/json: payInvoiceInput.
| Field | Type | Required | Description |
|---|---|---|---|
amount |
string (decimal) | yes | The amount paid, in the invoice's currency. Must be greater than zero and may not exceed the amount still due. |
paymentDate |
string (date) | yes | The date the payment was received or settled. Format YYYY-MM-DD. It drives the ledger posting and the reporting period. |
paymentType |
string, one of "check", "ach", "wire", "creditCard", "directDebit", "sepaCreditTransfer" |
yes | How the payment was tendered. |
paymentNote |
string | no | A free-text note recorded on the payment, for example a bank reference or check number. |
bankFeeAmount |
string (decimal) | no | The fee the bank or processor deducted, in the invoice's currency. Recorded on the payment rather than subtracted from it. Send the gross amount in amount. |
Example:
{
"amount": "1210.00",
"paymentDate": "2026-09-15",
"paymentType": "wire",
"paymentNote": "Remittance ref 88213",
"bankFeeAmount": "12.50"
}
Response
200 Success
Under data (payInvoiceOutput):
| Field | Type | Required | Description |
|---|---|---|---|
paymentId |
string | yes | The unique identifier for the payment created. Read it back with GET accounting/payments/:id, or re-read the invoice for its updated balance. |
Response headers
Idempotency-Replayed— Present andtrueonly when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent asfalse.
Errors
| Code | Status |
|---|---|
INVOICE_NOT_FOUND |
400 |
INVALID_AMOUNT |
400 |
AMOUNT_EXCEEDS_DUE |
400 |
IDEMPOTENCY_KEY_CONFLICT |
409 |
IDEMPOTENCY_PAYLOAD_MISMATCH |
422 |
Statuses
400— Invalid request or business failure. Codes: INVOICE_NOT_FOUND, INVALID_AMOUNT, AMOUNT_EXCEEDS_DUE401— Missing or invalid access token403— Not authorized404— Not found409— The Idempotency-Key is still being processed by another request.422— The Idempotency-Key was already used with a different request payload.429— Too many requests500— Internal server error