All work
Web App2024completed

Marketplace Commerce Platform

A multi-vendor marketplace handling secure split payments, payouts and webhooks across hundreds of sellers.

Client
ShopHub
Role
Backend Lead
Timeline
16 weeks
Status
completed
ShopHub e-commerce homepage: clean UI, "Mega Sale" banner with green armchair & plant, product categories, flash deals, trending.

The challenge

Processing money securely with idempotent split payments and reliable multi-vendor payouts.

The solution

Idempotent webhook handlers, a ledger-based payments model and queued payouts with automatic retries.

Outcome

$2M+
processed
300+
vendors
0
double-charges

Key decisions

  • $2M+ processed with zero double-charges
  • 300+ active vendors with automated payouts
  • Idempotent webhook processing
  • Double-entry ledger for financial accuracy

Code highlights

Idempotent webhook
if (await seen(event.id)) return ok();
await recordLedger(event);

Checking event id first makes webhook handling idempotent.

Ledger entry
DB::transaction(fn() => Ledger::post($debit, $credit));

A double-entry ledger inside a transaction guarantees correctness.