Back to blog
3 min read

Stripe webhooks: five ways a paid order goes wrong

The customer paid and your system says they didn't. Five traps between Stripe and your shop, in plain words, and what to ask your developer to check.

A customer pays on your site and Stripe takes the money. Then your system has to hear about it, and that is where things break: an order stays unpaid although the money arrived, a customer gets two confirmations and thinks they were charged twice, a subscription ends on your side while Stripe keeps charging the card.

The message Stripe sends your system after a payment is called a webhook. Stripe's docs explain how to receive one, not what goes wrong once real customers pay. Here are the five traps I close before any Stripe integration goes live.

Anyone can send "payment succeeded"

Stripe delivers its messages to an address on your server, and that address is public. Without a check, anyone who finds it can send a fake "payment succeeded", and your system ships the order.

Fix: every Stripe message carries a signature only Stripe can produce. Your system checks it and rejects anything that fails. It proves less than people think, though: that the message came from Stripe, not that you haven't handled it already.

Stripe sends the same message twice

If your system doesn't confirm a message quickly, Stripe assumes it got lost and sends it again, for days if it has to. So your system will see some payments more than once.

Watch out: if your system creates an order every time it hears "paid", one payment becomes two orders, two invoices and two confirmation emails. To the customer, it looks like a double charge.

Fix: every Stripe message has an ID, and a resend keeps the same one. Your system records each ID it handles and ignores any it has seen before.

Messages arrive out of order

Stripe sends messages in the order things happen. They don't always arrive in that order: "invoice paid" can land before "invoice created".

Watch out: a system that expects the right order looks for the invoice, doesn't find it and drops the message. The money has arrived, the order says unpaid, and you send a reminder to a customer who already paid.

The way out: when your system meets something it doesn't know yet, it asks Stripe, and it trusts the payment's current status, not the order the messages came in.

A slow answer counts as no answer

Stripe waits only a short time for a reply. A system that first sends emails, builds a PDF invoice and updates three other tools misses that window, and Stripe sends the message again, straight into the duplicate problem.

Subscriptions feel this most: a renewal your system never processes means a customer whose card was charged loses access.

Fix: my rule is a reply in under 5 seconds. The system notes "this arrived" and confirms. Everything slow happens afterwards, in the background.

Test money and real money need separate doors

Stripe runs a test mode with fake cards and a live mode with real money, each with its own keys and signing secret. Mix them up and test orders land in your real records, or a real payment never reaches your books.

I give each mode its own address, so a test message in the live shop fails with a visible error instead of mixing with real orders.

For your developer

What I check before a Stripe integration goes live:

  • Raw request body on the webhook route only, so the signature check works.
  • The signing secret that matches the environment, test or live.
  • A 2xx reply in under 5 seconds; slow work goes to a queue, deduplicated by event.id.
  • Unknown objects fetched from the Stripe API; state read from data.object.status, never from event order.
  • stripe.events.retrieve(id) in the worker, so a damaged job can re-fetch its event.
  • Alerts for failed deliveries, by email or Slack. Stripe lists them in its dashboard, and nobody checks that dashboard.

The core of it, in Express and MongoDB:

try {
  await Job.create({ kind: "stripe-event", eventId: event.id });
} catch (err) {
  // 11000: eventId is unique, so this is a resend. Anything else: let Stripe retry.
  if (err.code !== 11000) return res.status(500).end();
}
res.status(200).end();

Not sure which of the five your shop covers? Send this list to whoever built it, or book a call.

Blog

Read next