Skip to main content

Preview Inventory Debt Settlement

POST 

/api/inventory/debt/claims/settle-preview

Read-only preview of what settling the selected inventory debt claims would consume, without consuming it.

Required scope: inventory:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Walks the same date-eligible, non-consignment stock layers in the same order the settlement itself does, so the preview cannot promise one thing and the settlement do another. Each source layer also carries the positive inventory event that created it (the receipt, stock take or transfer), so the origin of the stock is traceable.

Nothing is written. Call Settle Inventory Debt Claims to commit.

Request body:

  • claim_ids (array of integer, required, 1-200) - the claims to preview

Response 200:

  • data.coverable_units (number) - units that would be repaid now
  • data.shortfall_units (number) - units that would stay outstanding
  • data.repayable_claims (integer) - claims with at least one covering layer
  • data.total_claims (integer) - outstanding claims in the selection
  • data.estimated_variance (number) - total cost variance that would post
  • data.claims[] (array) - per-claim breakdown
    • claim_id (integer)
    • product_id (integer)
    • sku (string, nullable)
    • warehouse_id (integer)
    • warehouse_name (string, nullable)
    • owed (number) - units still owed
    • covered (number) - units this preview would repay
    • estimated_unit_cost (number) - provisional cost carried until settlement
    • sources[] (array) - the stock layers that would be consumed
      • fifo_layer_id (integer)
      • received_at (string, nullable, Y-m-d)
      • quantity (number)
      • unit_cost (number) - actual cost of the layer
      • variance_per_unit (number) - actual minus estimate
      • origin (object, nullable) - the positive inventory event that created the layer
        • link_type (string, nullable)
        • link_id (integer, nullable)
        • name (string, nullable)
        • parent_link_id (integer, nullable)
        • detail_link_id (integer, nullable)
        • reference (string, nullable)
  • data.claims[].product_id (integer) and data.claims[].warehouse_id (integer) - so the caller can link the claim's product and warehouse

Request

Responses

OK

Response Headers
    Content-Type