Stripe: the order that never shipped
From Black Friday to Cyber Monday 2025, businesses on Stripe took more than 578 million payments, up to 152,000 a minute. Your shop is one of them: 3,000 req/s at the peak, and 3 in 100 are people paying, 90 a second. Payments work. But support says some people paid and never got their order, and a few got it twice.
Play this levelPart of Bugpit Pro. It runs in your browser: build the design, press Run, and watch what breaks.
The lesson
A payment doesn't end when the card is charged. Stripe sends the buyer's browser back to your site, and separately calls your server with a webhook: a message saying the payment went through.
Your shop sends the order when the browser comes back. But a buyer who closes the tab or loses signal has paid and never comes back. The webhook arrives anyway, so the webhook is what should send the order. The thank-you page is just a page.
Webhooks come at least once, not exactly once. Stripe says the same event can arrive twice, and in any order. Save each event's ID when you handle it and skip any ID you've already seen. For order, don't trust which event came last: ask Stripe for the payment's current state.
Answer fast. If your handler saves the order, emails the receipt and books the courier before replying, slow ones time out. Stripe marks them failed and sends them again, for up to three days. Save the event, answer OK, and let a worker do the rest from a queue.
What you have to achieve
3,000 requests a second at the busiest hour, 3% of them writes.
- No broken or illegal connections
- Use Email & Push
- Every paid order is sent, even if the buyer closes the tab
- An event sent twice is handled once
- Webhooks are answered before the slow work starts
- No component is overloaded
- Workers clear the queue within the day
- Fewer than 0.1% of requests fail
- p99 response time under 1 s
What you learn
Treat a webhook like a letter: it can come late, twice or out of order, so save it, answer, and act on it once. Every provider that calls you back works this way, so the same three ticks apply to PayPal, Razorpay, Shopify and GitHub.
The real numbers behind it
- From Black Friday to Cyber Monday 2025, businesses on Stripe processed more than 578 million transactions, peaking at more than 152,000 a minute (Reported: Stripe: businesses processed more than $40 billion from Black Friday through Cyber Monday)
- Webhook endpoints might occasionally receive the same event more than once, and Stripe doesn't guarantee the order events arrive in (Published: Stripe docs: receive Stripe events in your webhook endpoint)
- Stripe retries a failed webhook for up to three days in live mode, and asks you to answer with a success code before any slow work (Published: Stripe docs: receive Stripe events in your webhook endpoint)
- Stripe's guide sends orders from the checkout.session.completed webhook, and warns the same session may reach your code more than once (Published: Stripe docs: fulfil orders)
- 3,000 req/s with 3 in 100 paying is an example shop, not a Stripe customer's real numbers. How many buyers close the tab, and how often events repeat, are estimates (Estimate)
Check yourself
A buyer pays, then closes the tab before Stripe sends them back to your site. What sends their order?
- Nothing: they never came back
- The webhook Stripe sends to your server
- The thank-you page, once it loads
Show the answer
The webhook Stripe sends to your server. The webhook arrives whether or not the browser comes back. The thank-you page is only for the buyer.
The same payment_intent.succeeded event arrives twice. What stops the order going out twice?
- Comparing the events' created times
- Saving each event's ID and skipping any ID already handled
- Answering the second one more slowly
Show the answer
Saving each event's ID and skipping any ID already handled. Stripe says events can repeat and arrive in any order, so it tells you to track event IDs, not times.
Why answer a webhook before emailing the receipt and booking the courier?
- A slow answer times out, and Stripe sends the event again
- Emails are cheaper later
- Stripe charges per second of waiting
Show the answer
A slow answer times out, and Stripe sends the event again. Stripe treats a slow reply as a failure and retries for up to three days. Save it, answer, then work from a queue.