Settlement API

Endpoint path /api/v1/escrow — legacy name kept for compatibility.

Successful orders are held (payment held) until the goods are delivered. Advance the lifecycle server-to-server as you fulfil the order; releasing the order settles your QOOP-Pay settlement balance (amount minus your commission) and fires the escrow.released webhook.

POST /api/v1/escrow
Content-Type: application/json

{
  "live_api_key": "qpk_live_…",
  "transaction_ref": "QP-ABC123",      // or "order_id": "ORD-77" — one is required
  "event": "dispatched"                 // dispatched | delivered | release
}

Events

eventOrder stateMeaning
dispatchedDISPATCHEDOrder handed to the delivery channel
deliveredDELIVERED_CONFIRMEDDelivery confirmed
releaseESCROW_RELEASEDFunds released to your settlement balance (amount − commission)

Transitions move forward one step at a time — successful payments start held (ESCROW_HOLD) when the checkout completes. Repeating an event whose state already applies succeeds idempotently with "replayed": true.

Responses

// 200 — transition applied
{ "ok": true, "transaction_ref": "QP-ABC123", "order_id": "ORD-77",
  "escrow_state": "ESCROW_RELEASED", "replayed": false,
  "settlement": { "gross": "50000.00", "commission": "2500.00", "net": "47500.00" } }  // release only

// 200 — idempotent replay
{ "ok": true, "transaction_ref": "QP-ABC123", "order_id": "ORD-77",
  "escrow_state": "DISPATCHED", "replayed": true }

// errors — { "ok": false, "error": "…" }
400 bad request (missing fields, unknown event) · 401 invalid live_api_key
404 transaction not found (or not yours)       · 409 invalid transition / ambiguous order_id

Auto-release

Members confirm delivery from their transactions page, which settles the order instantly and credits your balance the same way as a release call. Orders that wait past the auto-release window (7 days from the last state movement, configurable in QOOP-Pay) are settled automatically by the platform on the same terms. If the buyer reports a problem with the delivery, the order is excluded from auto-release until QOOP-Pay ops resolves the report — you will see it stay in the held state until then.

Order state changes are also visible in the MerchantHub portal transaction table, and settling from the portal or the demo store has the same effect as calling this endpoint. Payout requests draw on the settled balance from the MerchantHub portal; ops disbursement fires payout.paid.