Multi-Organizer Raffle Platform with Collision-Free Concurrent Checkout
Multi-tenant raffle marketplace where independent organizers accept direct payouts via Stripe Connect while guaranteeing zero duplicate ticket numbers under simultaneous checkout spikes.
Built on Laravel 12, Jetstream, and Inertia/Vue 3 using Stripe Connect destination charges (application_fee_amount), composite SQL unique constraints, and idempotent webhook handlers.
Concurrency & Payout Challenge
During peak raffle drops, dozens of buyers attempt to purchase the same ticket numbers within milliseconds. Application-level checks alone lead to double-sold tickets or orphaned payments. Additionally, each organizer needed direct payouts to their own bank account while the platform collected an automated commission.
Architecture Decisions
- Multi-team isolation with Laravel 12 + Jetstream: Organizers manage their own raffles, ticket bundles, and winners independently.
- Stripe Connect split payments: Organizers onboard via Stripe Connect; payments settle directly on connected accounts while automatically routing
application_fee_amountto the platform. - Database-enforced ticket uniqueness: A strict composite unique constraint on
(raffle_id, number)guarantees atomicity even when concurrent requests hit the database simultaneously. - Idempotent webhook fulfillment: Ticket issuance runs idempotently upon Stripe payment confirmation (
firstOrCreate), ensuring network retries never mint duplicate entries. - Reactive UI with Inertia + Vue 3: Fast public ticket pickers and real-time organizer dashboards.
Key Outcome
Mathematically collision-free ticket allocation under concurrent traffic paired with zero-touch split settlements via Stripe Connect.