One checkout can contain orders from several sellers. Each seller order moves on its own, but they share one checkout.
TL;DR
NDA note: one checkout, one child order per seller, and idempotent refunds on a checkout those orders share.
live trace · Return received and refundfrom the original diagram
01
Seller → APImark return received
02
API → Child orderlock row
03
API → Return casestate = received
04
API → Child ordercancelled, seller income held
05
API → Stockrestore on hand, once per order
06
API → Checkoutrefund, partial if sibling orders are still confirmed
…
01
Background
+
One checkout can contain orders from several sellers. Each seller order moves on its own (ship, deliver,
cancel, return), but they share one checkout.
02
How it works
+
Each seller gets a child order with its own items, address, fulfilment record, seller income record and
status history.
Confirmed flow: seller confirms, ships with tracking, marks delivered; the buyer confirms receipt or the order
auto-completes after a window.
Seller income is credited to the seller's balance only after a buffer period following completion.
Cancellations: buyer request with seller approval, overdue cancellation by a scheduled job, or admin
force-cancel.
Returns: buyer requests, seller approves or rejects, buyer can escalate to admin; when goods come back,
stock and any store credit are restored and the refund is issued.
Store-credit refunds complete immediately; cash refunds stay pending until an admin confirms the transfer.
03
Design decisions
+
Every refund and restore step is idempotent, guarded by a status
or timestamp check, so retries are safe.
Partial vs full refund on a shared checkout: the checkout is marked
partially refunded while any other order in the same checkout is still confirmed.
Seller income on a timer, not at delivery, to leave room for
returns; credited once, guarded by a timestamp, with lock ordering and deadlock retry.