[POST] .../v1/retailcustomer/adddebt
Creates a customer debt Use this method to create a debt ledger record for a retail customer sale cheque, typically from POS cheque processing when part of the sale remains unpaid. The request requires customer_id, uuid, date, amount and paid according to the current request validation metadata and returns new_id for the debt record; paid is the already paid part of the sale cheque. The method checks the current request user and requires retail customer edit permission; it validates that the customer exists, that uuid is present, that date and amount are positive and that paid is accepted by validation and returns missing-field, invalid-amount, permission, duplicate debt uuid, not-found and storage failures as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| amount | Decimal | Required | Total amount of the sale cheque that has the debt. |
| customer_id | Int64 | Required | Retail customer ID. |
| date | Int64 | Required | Date of the sale cheque that has the debt, as Unix time. |
| paid | Decimal | Required | Paid amount of the sale cheque that has the debt, excluding payment on credit. |
| uuid | String | Required | UUID of the sale cheque that has the debt. |
Request Example
{
"amount": 1.0,
"customer_id": 1,
"date": 1,
"paid": 1.0,
"uuid": "00000000-0000-0000-0000-000000000000"
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert | Created record result. |
Response Example
{
"ok": true,
"result": {
"new_id": 1
}
}