Stripe webhook created a duplicate order

Stripe delivers webhooks at least once, not exactly once. Here is why duplicates happen, the fix, and how to make sure it never comes back.

Why Stripe sends the same event twice

Stripe retries a webhook when your endpoint is slow, times out, or answers with anything other than 2xx — and sometimes delivers twice even when it succeeded. Two copies can arrive at the same moment, so a handler that checks 'is this order paid?' and then marks it paid can run twice before either write lands. The result: two shipments, two credits, two confirmation emails.

The fix: make the handler idempotent

Store every processed event ID (event.id) with a unique constraint, and do the order update in the same transaction. If the insert fails because the ID already exists, acknowledge with 200 and stop. Answer quickly (do slow work in a queue) so Stripe has no reason to retry, and never rely on 'check then write' without a lock or unique key.

Test it before your customers do

MockCard's duplicate scenario fires the same signed event twice, concurrently — the exact race that breaks handlers. Run it in CI with the GitHub Action or an SDK, and add an assertion that the order was fulfilled exactly once. If a refactor removes the idempotency check, the build fails instead of your checkout.

Webhook Health Check

Score your payment handler out of 100 against real failure scenarios — free, no signup

https://

Fires 5 probes · ~5 seconds · score out of 100 · no account required

Nothing stored

Your URL and responses are never saved.

No abuse

5 labelled test requests. Rate-limited.

Testing only

Fictitious payments — no real money moves.

Only test endpoints you own. How the check works

Frequently asked questions

Does Stripe guarantee each webhook is delivered once?
No. Stripe's delivery is at-least-once: your endpoint must expect duplicates and ignore events it has already processed.
Can I reproduce a duplicate webhook in Stripe's test mode?
You can resend an event from the dashboard, but not two copies at the same moment. MockCard sends both concurrently, which is what exposes race conditions.

Related guides