MapleLock Reservation Engine
Stripe test mode
The failure this engine prevents

Two guests grab the last box
at the exact same instant.

At 01:00 on a Friday it happens for real — two people pay for the last free Small Box and both get assigned it. Below, fifty do it at once. Watch exactly one win.

The race

50 guests all request “a Small Box” at once · 1 is free
session created
clean rejections · 409
double-bookings
for all 50 requests

Guaranteed by one statement — SELECT … FOR UPDATE OF b SKIP LOCKED — backed by a partial unique index that makes any double-book fail closed at the database. No Redis, no app locks, no retry loops.

The guest journey

Every tap hits the real API. The box is held before you pay; the number is revealed only after payment confirms.

Club Prisma
Main Cloakroom
Scan any box in the zone · pick a size
Order summary
Small Box€5.00
VenueClub Prisma
ZoneMain Cloakroom
Session until10:00
120
sec hold
A specific box is reserved for you. Pay before the hold expires.
You're in
A01
Your box · valid until 10:00
slide to open
Hold expired
The box was returned to the pool for the next guest. No charge was made.

Live zone

Club Prisma · Main Cloakroom · 40 boxes

free held active session offline out of service
Hold before pay

A TTL hold locks a specific box the instant you pick a product — before Stripe. If you don't pay in time, the sweep returns it to the pool.

Two clocks

The hold TTL is far shorter than Stripe's 30-minute floor, so it expires the checkout early. If a payment still lands late, the session reassigns to another free box — or refunds.

Vendor-decoupled

Box online-state is a cached column behind a BoxStateProvider interface — never a live per-request call to the hardware vendor. Swapping in the real adapter is one line.