Resolve with Vendor Credit
POST/api/purchase-invoices/:purchaseInvoice/resolve-with-credit
Resolve an over-billed purchase invoice by issuing a vendor credit for the over-billed quantities and auto-allocating it against the bill.
Authentication: Requires Bearer token.
The credit is created in open status with restock_inventory=false (it's a billing correction, not a physical return). After the credit is allocated, the invoice's approval status is re-evaluated so the variance flag clears automatically when the credit fully offsets the over-bill.
Request body fields:
lines(required, min 1): array of{ purchase_order_line_id, quantity }. Eachquantitymust be > 0 and ≤ the over-billed quantity for that PO line.credit_date(optional, nullable, date): defaults to today.supplier_reference(optional, nullable, max 255): defaults to the invoice'ssupplier_invoice_number.reason(optional, nullable, max 2000): copied into the vendor credit's note.
Validation errors return 422 with a message for: invoice not linked to a PO, PO line not on this invoice, PO line not on this invoice's PO, requested quantity exceeds over-billed delta, or no over-billed quantities provided.
Returns the newly created VendorCredit (eager-loaded with supplier, currency, lines, and allocations).
Request
Responses
- 200
Successful response