Treasury
Link a payment to a document
Ties an already recorded payment to the invoice, credit note, quote, proforma or purchase order it settles.
treasury:writeResult
generated from the schema
It is a plural sub-resource because a payment can end up tied to several documents. Returns the full payment, with linkedDocuments as they now stand, the same projection as its GET.
Arguments
Treasury payment identifier.
Limits: min length 1
Type of the document the payment is linked to.
Available options: invoice, creditNote, supplierInvoice, quote, proforma, salesReceipt, simpleCreditNote, purchaseOrder
Document the payment is linked to.
Limits: min length 1
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 POST /api/v1/treasury/payments/{paymentId}/links.
Related pages
Link to this section: Related pagesTreasury
Link a payment to a document
Ties an already recorded payment to the invoice, credit note, quote, proforma or purchase order it settles.
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?