Treasury
Update a payment
Corrects an already recorded payment or marks it as reconciled with the bank statement.
treasury:writetreasury:write- 120/min
- Server annotation: Idempotent
Result
generated from the schema
reconciled and notes are accepted and not returned: they are state of the internal accounting process. The date follows the rule of the creation: any time of today, not a later day in the time zone of the account (400 on date). A new amount moves the assignment only when the whole payment was assigned to a single document or order; on any other payment only the unassigned part changes, so the documents keep what they had collected, and an amount below what is already assigned responds 409 conflict without writing. A refunded deposit, and the refund itself, keep their amount and direction: changing either responds 409 conflict and nothing is written. If the documents linked to the payment keep changing while it is saved, it also responds 409 conflict, nothing is written and the call can be retried. Returns the full payment, the same projection as its GET.
Arguments
Treasury payment identifier.
Limits: min length 1
New direction of the payment.
Available options: in, out
New amount as a decimal string, greater than zero. If the whole payment is assigned to a single document or order, the assignment follows the new amount. Otherwise what is assigned stays as it is and only the unassigned part changes; an amount below what is already assigned responds 409 conflict.
Limits: pattern ^\d{1,13}(\.\d{1,2})?$
New date, in ISO 8601 with offset. Any time of today is accepted; a later day, in the time zone of the account, is rejected with 400.
New payment method; null removes it.
New contact; null unlinks it.
New external reference; null clears it.
Limits: max length 200
New notes. NOT returned.
Limits: max length 2000
Marks the payment as reconciled with the bank statement.
Idempotency key chosen by the client (a UUID is recommended). Repeating the same key with the same arguments within 24 h returns the stored response without executing again; with different arguments it responds 422. It is the safe way to retry after a network failure.
Limits: min length 1, max length 255
Optimistic locking: the meta.etag you got from the detail read of this resource (or "*"). If the resource changed since, the call fails with 412 precondition_failed before writing anything; read it again and retry. Omit it to write unconditionally.
Limits: min length 1
Result
On success the result carries structuredContent with data and meta. These are the attributes of data.
Show the attributes of data
Payment identifier.
in when money comes in (a collection) and out when it goes out (a payment).
Payment amount as a decimal string, in the indicated currency.
Limits: pattern ^-?\d+\.\d{2}$
Payment currency, as an ISO 4217 code.
Payment date in ISO 8601 UTC.
normal, or deposit when it is an advance payment.
Treasury account the payment goes through.
Customer or supplier of the payment; null if not declared.
External reference of the payment; null if it has none.
Documents the payment is assigned to; empty if it is not linked to any.
Show child attributesHide child attributes
Kind of the linked document.
Available options: invoice, creditNote, supplierInvoice, quote, proforma, salesReceipt, simpleCreditNote, purchaseOrder
Identifier of the linked document.
Amount of this payment assigned to the document, as a decimal string.
Limits: pattern ^-?\d+\.\d{2}$
Creation date in ISO 8601 UTC.
Last modification date in ISO 8601 UTC.
An error is a result with isError: true and the problem in content[0].; there is no structuredContent. See Errors.
The same operation by REST
This tool runs PATCH /api/v1/treasury/payments/{paymentId}.
Related pages
Link to this section: Related pagesTreasury
Update a payment
Corrects an already recorded payment or marks it as reconciled with the bank statement.
Guides
Safe writes
An assistant that can write can also write the wrong thing. Decide which tools need a person, retry without duplicating, and know what a write sets in motion.
Guides
Errors
A tool error is a result with
isError: trueand the problem in the first text block. Branch on itscode.
Was this page helpful?