A customer pays, and then something breaks
The problem
Once payment precedes account creation, the checkout webhook is the only thing standing between a paying customer and no account at all. Stripe redelivers webhooks, fires its checkout and subscription events in an unpredictable order, and a buyer can close the browser the moment the card clears. Provisioning is not one write: it is an auth user, a profile, a clinic, a setup record, a subscription row and an outbound email, six side effects with no shared transaction.
What we did
Every checkout became a first-class object in its own table with a lifecycle, from pending through retrying to completed, failed or needs support review, keyed by a unique Stripe session id. Replays short-circuit on records already completed, the whole provisioning body is wrapped so any throw writes the failure and its message to the record before re-raising, and a buyer whose clinic already has a different active subscription is parked for review rather than silently double-provisioned.
The outcome
Every paid checkout is visible, diagnosable and recoverable from an internal console, with retry, resend and reopen. Retry re-fetches the live Stripe session rather than trusting stored state.













