Webhooks processed twice: duplicate payments, emails and orders

Last updated November 13, 2026
Steps
- Find every webhook endpoint in your app (payments, store, auth, Git hosting, email provider) and write down what side effects each one causes.
- Verify the signature on every request with the provider’s library and the raw request body, and keep the timestamp check on; Stripe’s libraries use a 5-minute default tolerance and warn not to set it to 0.
- Store the unique delivery or event ID (Stripe event id, Shopify X-Shopify-Webhook-Id, GitHub X-GitHub-Delivery) in a table with a unique constraint, and skip any event you’ve already recorded.
- Insert the event ID and do the work in one database transaction, or use the unique constraint as a lock, so two copies arriving at the same moment can’t both run.
- Don’t rely on event order: Stripe says not to use the created timestamp to decide order or whether you’ve already processed an event. Fetch the current object from the API when order matters.
- Return a 2xx quickly and move slow work (emails, fulfillment) to a background job keyed by the same event ID.
- Make the side effects themselves safe to repeat where you can, for example “set status to paid” instead of “add 100 credits.”
- Retest: resend the same event from the provider’s dashboard or CLI and confirm only one email, credit or order results.
Why it matters
Stripe retries live-mode deliveries for up to three days when your endpoint doesn’t return 2xx, and a manual resend doesn’t cancel the automatic retries, so duplicates are normal, not rare. Stripe also says two separate Event objects can be sent for the same change; to catch those, combine the ID of the object in data.object with the event type. GitHub’s webhook guidance suggests using the X-GitHub-Delivery header to protect against replay attacks, and notes that a redelivery keeps the same delivery ID. This page is for checking and fixing your own app.
Sources
Stripe Docs: Receive Stripe events in your webhook endpoint (handle duplicate events, event ordering, retries, replay protection) — https://docs.stripe.com/webhooks
Shopify Dev Docs: Verify webhook deliveries (ignoring duplicates) — https://shopify.dev/docs/apps/build/webhooks/ignore-duplicates
GitHub Docs: Best practices for using webhooks — https://docs.github.com/en/webhooks/using-webhooks/best-practices-for-using-webhooks
Checked at the source on November 13, 2026.
Related patterns
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.