Multi-Seller Marketplace Channel
Client, brand and business rules are white-labelled. Lead backend developer and designer (lead-approved) — Laravel, MySQL.
- Role
- Lead backend developer and designer (lead-approved)
- Stack
- Laravel, MySQL
- Scope
- Seller onboarding to refunds, in a second channel of an existing app
- Result
- Full flow went live; handed over, the team continues to run and extend it
The problem → the solution
source: project write-up- ✕Two channels had to share one cart and one checkout, while stock, checkout and order flows stayed separate per seller.
- ✕Stock is limited per variant. Two buyers must never both get the last unit, but idle carts should not lock stock either.
- ✕Provider confirmation is asynchronous. It can arrive late (after the buyer cancelled), twice, or not at all.
- ✕One checkout can include orders from several sellers, and each can be cancelled or refunded on its own.
- 01A seller onboarding and catalog module with up to two variant axes per product and a price and stock row per variant.
- 02A cart extended with a channel flag so both channels coexist in one basket.
- 03Stock is held when the buyer opens the checkout summary, not when they add to cart, and released when they leave or the hold expires.
- 04One checkout session groups child orders, one per seller, under one checkout.
- 05Cancel, provider confirmation and a background check all go through the same locked path, so the order ends in one consistent state whichever arrives first.
- 06A per-seller order lifecycle with cancellation, return and refund cases, and seller income credited only after a buffer period.
Overall flow
source: site · original diagram- 01Seller applies→ Admin approves
- 02Admin approves→ Seller lists products and variants
- 03Seller lists products and variants→ Buyer adds to shared cart
- 04Buyer adds to shared cart→ Checkout summary: stock held
- 05Checkout summary: stock held→ Place order: one session, one order per seller
- 06Place order: one session, one order per seller→ Confirmed by provider?
- 07◆ Confirmed by provider?→ Seller confirms and ships [yes]→ Holds released [no / cancelled]
- 08Seller confirms and ships→ Delivered
- 09Holds released
- 10Delivered→ Completed→ Return or refund case
- 11Completed→ Seller income released after buffer
- 12Return or refund case
- 13Seller income released after buffer
Checkout to confirmation
source: site · original diagram- 01Buyer → APIopen checkout summary
- 02API → Stock holdshold each variant, row lock
- 03Buyer → APIplace order
- 04API → Checkout sessioncreate session and one order per seller
- 05API → Providercreate provider request
- 06Provider → APIconfirmed, async
- 07API → Checkout sessionlock session, mark confirmed
- 08API → Stock holdsconsume holds
Main data model (simplified)
source: site · original diagramTap a table to see what it links to.
- SELLER_STORE lists PRODUCT 1 → many
- PRODUCT has VARIANT 1 → many
- BUYER has CART_LINE 1 → many
- VARIANT in CART_LINE 1 → many
- VARIANT reserved by STOCK_HOLD 1 → many
- CHECKOUT_SESSION owns STOCK_HOLD 1 → many
- CHECKOUT_SESSION groups CHILD_ORDER 1 → many
- CHECKOUT_SESSION confirmed by PROVIDER_RECORD 1 → many
- SELLER_STORE fulfils CHILD_ORDER 1 → many
- CHILD_ORDER has ORDER_LINE 1 → many
- CHILD_ORDER credits SELLER_INCOME 1 → 0..1
- CHILD_ORDER may have RETURN_CASE 1 → many
Features
10 items- 01Seller apply, re-apply after rejection, admin approve or reject
- 02Shop locations with operating hours, account details, vacation mode
- 03Category-driven attributes; products with up to 2 variant axes and per-variant price and stock
- 04Shared cart across channels
- 05Checkout summary with stock holds and automatic expiry
- 06Multi-seller checkout under one checkout
- 07Seller flow: confirm, ship (with tracking), mark delivered
- 08Buyer flow: received, cancel request, return and refund request, escalation
- 09Admin attention queue: disputes, forced cancels, manual refund confirmation
- 10Scheduled jobs: hold expiry, seller reminders, overdue cancellation, auto-complete, seller income release
More details
open a row to read more01Overview
Overview
The client already ran a marketplace app with its own catalog, accounts and cart. They wanted a second channel where independent sellers open shops and sell their own products, inside the same app, the same cart and the same checkout. I designed the channel end to end (approved by my lead) and wrote most of its core services.
What already existed (team / platform): buyer accounts and addresses, category tree, authentication, admin panel shell, media library, and the original channel's orders. Some later moderation features on shops (suspensions, visibility rules) were added by a colleague.
02Engineering highlights
Engineering highlights
Stock correctness under concurrency: row locks on the variant before checking availability; a separate held counter, so on-hand stock only changes when an order is really confirmed or returned; a fixed lock order (variant, then hold) everywhere.
Late and duplicate checkout events: cancel asks the checkout provider first and does not cancel if the provider is unreachable; a late confirmation revives a cancelled checkout instead of losing a confirmed order; a duplicate confirmation does nothing; a background check recovers checkouts whose confirmation never arrived.
Idempotent refunds: every refund and restore step checks whether it already ran, so retries and double clicks are safe. A shared checkout is marked partially refunded while other orders in the same checkout are still confirmed.
Explicit state machines for shops, holds, orders, refunds and return cases, with a status history per order.
Scheduled jobs that cannot overlap, and seller income credited once with a timestamp guard.
03Result
Result
The full flow from seller onboarding to checkout, fulfilment and refunds went live. I handed it over after delivery and the team continues to run and extend it.