2.5 KiB
Phase 2E: supplier payment records
This API records evidence of payments made outside Mani Candles. It does not initiate a bank transfer, call a payment gateway, or verify settlement with a bank.
All routes are under /api/v1 and require a bearer token. Reads require procurement.read. Recording and reversing a payment require the separate supplier_payment.manage permission. Every lookup is scoped to the signed-in organization.
| Method | Route | Purpose |
|---|---|---|
| GET | /supplier-invoices/:invoiceId/payments |
Page through payments and read paid and outstanding totals |
| POST | /supplier-invoices/:invoiceId/payments |
Record a partial or full payment |
| GET | /supplier-payments/:id |
Read a payment and its reversal, if any |
| POST | /supplier-payments/:id/reverse |
Reverse one payment with a reason |
Record with {"idempotencyKey":"<uuid>","reference":"UTR-12345","method":"BANK_TRANSFER","amount":"50.00","paidDate":"2026-09-28"}. Methods are BANK_TRANSFER, UPI, CHEQUE, CASH, and OTHER. The reference is normalized to uppercase and must be unique within the organization, including after reversal. For cash, use a unique internal voucher reference. Payment amount uses exactly two decimal places and must be positive. Currency comes from the invoice.
Reusing the same idempotency key with the same invoice and payload returns the original payment; a different payload returns PAYMENT_REPLAY_CONFLICT. A payment cannot exceed the invoice's outstanding total or be recorded against a void invoice. Reverse with {"reason":"Bank transfer returned"}. The reversal is immutable, releases the amount from the invoice balance, and can occur only once. An invoice with an active payment cannot be voided; reverse its payments first. All writes create audit events.
The list accepts limit (default 25, maximum 100) and offset (default 0). It returns payableTotal, paidTotal, outstandingTotal, currency, and the requested page of payments. Totals include all active payments regardless of the page. These are recorded accounting amounts, not bank-verified settlement status. Bank reconciliation, proof documents, and approval thresholds remain future work.