AddDebtPayment

[POST] .../v1/retailcustomer/adddebtpayment

Adds a debt payment Use this method to add a payment record against an existing retail customer debt and increase the paid amount on that debt. The request requires customer_id, debt_uuid, payment_uuid, date and amount and returns new_id for the created payment record. The method checks the current request user and requires retail customer edit permission; it validates that the customer and debt exist and that payment amount is positive and not greater than the outstanding debt and returns missing-field, invalid amount, overpayment, permission, not-found, duplicate payment 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.
debt_uuid String Required UUID of the sale cheque that has the debt.
payment_uuid String Required UUID of the sale cheque that pays the debt.

Request Example

{
  "amount": 1.0,
  "customer_id": 1,
  "date": 1,
  "debt_uuid": "00000000-0000-0000-0000-000000000000",
  "payment_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
  }
}