← Selected work
Confidential / NDA

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
01 — Problem → solution

The problem → the solution

source: project write-up
before · the problem

  1. ✕
    Two channels had to share one cart and one checkout, while stock, checkout and order flows stayed separate per seller.
  2. ✕
    Stock is limited per variant. Two buyers must never both get the last unit, but idle carts should not lock stock either.
  3. ✕
    Provider confirmation is asynchronous. It can arrive late (after the buyer cancelled), twice, or not at all.
  4. ✕
    One checkout can include orders from several sellers, and each can be cancelled or refunded on its own.
after · the solution

  1. 01
    A seller onboarding and catalog module with up to two variant axes per product and a price and stock row per variant.
  2. 02
    A cart extended with a channel flag so both channels coexist in one basket.
  3. 03
    Stock is held when the buyer opens the checkout summary, not when they add to cart, and released when they leave or the hold expires.
  4. 04
    One checkout session groups child orders, one per seller, under one checkout.
  5. 05
    Cancel, provider confirmation and a background check all go through the same locked path, so the order ends in one consistent state whichever arrives first.
  6. 06
    A per-seller order lifecycle with cancellation, return and refund cases, and seller income credited only after a buffer period.
02 — Flow

Overall flow

source: site · original diagram
live trace · Overall flowscroll to play · tap a step on mobile
yes no / cancelled Seller applies Admin approves Seller lists productsand variants Buyer adds to sharedcart Checkout summary:stock held Place order: onesession, one order perseller ◆ Confirmed byprovider? Seller confirms andships Holds released Delivered Completed Seller income releasedafter buffer Return or refund case
  1. 01
    Seller applies→ Admin approves
  2. 02
    Admin approves→ Seller lists products and variants
  3. 03
    Seller lists products and variants→ Buyer adds to shared cart
  4. 04
    Buyer adds to shared cart→ Checkout summary: stock held
  5. 05
    Checkout summary: stock held→ Place order: one session, one order per seller
  6. 06
    Place order: one session, one order per seller→ Confirmed by provider?
  7. 07
    ◆ Confirmed by provider?→ Seller confirms and ships [yes]→ Holds released [no / cancelled]
  8. 08
    Seller confirms and ships→ Delivered
  9. 09
    Holds released
  10. 10
    Delivered→ Completed→ Return or refund case
  11. 11
    Completed→ Seller income released after buffer
  12. 12
    Return or refund case
  13. 13
    Seller income released after buffer
03 — Sequence

Checkout to confirmation

source: site · original diagram
live trace · Checkout to confirmationscroll to play · tap a step on mobile
Buyer API Stock holds Checkout session Provider 01open checkout summary 02hold each variant, row lock 03place order 04create session and one order per seller 05create provider request 06confirmed, async 07lock session, mark confirmed 08consume holds
  1. 01
    Buyer → APIopen checkout summary
  2. 02
    API → Stock holdshold each variant, row lock
  3. 03
    Buyer → APIplace order
  4. 04
    API → Checkout sessioncreate session and one order per seller
  5. 05
    API → Providercreate provider request
  6. 06
    Provider → APIconfirmed, async
  7. 07
    API → Checkout sessionlock session, mark confirmed
  8. 08
    API → Stock holdsconsume holds
04 — Data model

Main data model (simplified)

source: site · original diagram
explorer · Main data model (simplified)click a table

Tap a table to see what it links to.

SELLER_STORE
PRODUCT
VARIANT
BUYER
CART_LINE
STOCK_HOLD
CHECKOUT_SESSION
CHILD_ORDER
PROVIDER_RECORD
ORDER_LINE
SELLER_INCOME
RETURN_CASE
  • 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
05 — Features

Features

10 items
  1. 01Seller apply, re-apply after rejection, admin approve or reject
  2. 02Shop locations with operating hours, account details, vacation mode
  3. 03Category-driven attributes; products with up to 2 variant axes and per-variant price and stock
  4. 04Shared cart across channels
  5. 05Checkout summary with stock holds and automatic expiry
  6. 06Multi-seller checkout under one checkout
  7. 07Seller flow: confirm, ship (with tracking), mark delivered
  8. 08Buyer flow: received, cancel request, return and refund request, escalation
  9. 09Admin attention queue: disputes, forced cancels, manual refund confirmation
  10. 10Scheduled jobs: hold expiry, seller reminders, overdue cancellation, auto-complete, seller income release
06 — Details

More details

open a row to read more
01

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.

02

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.

03

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.

04

Technical notes