Edit

[POST] .../v1/docpayment/edit

Edits payment document. Update a payment by id and return row_affected. Requires edit permission for its income/expense direction. Main fields, including stock_id, require an unposted document; description and custom fields remain editable after posting. For stock_id, contract_id and attached_user_id, null preserves and zero clears. The resulting stock must match the company. Business errors return HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
amount Decimal Optional New payment amount with up to 3 decimal places. Values less than or equal to 0 leave the existing amount unchanged.
attached_user_id Int64 Optional Responsible user patch value: null leaves it unchanged, 0 clears it and a positive ID sets a responsible user.
category_id Int64 Optional New income or expense category ID. It must keep the same direction as the existing document category.
contract_id Int64 Optional Contract document patch value: null leaves it unchanged, 0 clears it and a positive ID sets a new contract.
date Int64 Optional New document date as Unix time in seconds. Values less than or equal to 0 leave the existing date unchanged.
description String Optional Additional description patch value. Null leaves it unchanged; an empty string clears the description. Maximum length is 300 characters.
exchange_rate Decimal Optional New exchange rate for non-base currency payments with up to 8 decimal places. 0 leaves the existing rate unchanged.
fields Array of FieldValueEdit Optional Custom field values to add, update or remove.
firm_id Int64 Optional New company ID. Values less than or equal to 0 leave the existing company unchanged.
id Int64 Required Required payment document ID.
partner_id Int64 Optional New partner ID. Values less than or equal to 0 leave the existing partner unchanged.
stock_id Int64 Optional Optional stock patch for an unposted document: omitted or null leaves it unchanged, 0 clears it and a positive ID sets it. The resulting stock must belong to the resulting company.
type_id Int64 Optional New payment type ID. Values less than or equal to 0 leave the existing type unchanged.

Request Example

{
  "id": 42,
  "date": 1714554000,
  "amount": 2550000.000,
  "exchange_rate": 1.00000000,
  "description": "Updated prepayment description",
  "attached_user_id": 0
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "row_affected": 1
  }
}