Skip to main content

Variance Resolution Preview

GET 

/api/purchase-invoices/:purchaseInvoice/variance-resolution-preview

Preview over-billed quantities per PO line so the UI can prefill a 'Resolve with vendor credit' dialog.

Authentication: Requires Bearer token.

A line is considered over-billed when its effective invoiced quantity (quantity_invoiced minus quantity already credited on this bill via existing vendor credit allocations) exceeds the PO line's effective received quantity. Receipt sources match PurchaseOrderLine::getEffectiveReceivedQuantity() (standard warehouse receipts, FBA/AWD ledgers, accounting for any active short-close event).

The suggested credit quantity is exactly the over-bill delta. The suggested credit amount is over_billed * unit_price (invoice unit price, falling back to PO amount).

Response fields:

  • invoice_id, purchase_order_id, supplier_id, currency_id, currency_code
  • has_over_bills: true if any line has over-billed quantity
  • total_suggested_credit: sum of suggested_credit_amount across over-billed lines
  • lines[]: only includes lines with over-billed quantity. Each line has purchase_invoice_line_id, purchase_order_line_id, product_id, sku, product_name, quantity_invoiced, received_quantity, already_credited, over_billed_quantity, suggested_credit_quantity, unit_price, suggested_credit_amount.

Request

Responses

Successful response