Prompt
Why am I getting duplicate webhook events from Stripe?
Latest observation
Duplicate Stripe webhooks are usually caused by one of a few common things:
1) Stripe retries because your endpoint didn’t return 2xx
If Stripe doesn’t get a successful response quickly enough, it will retry the same event. This is the most common reason.
Check:
- Your endpoint returns a
2xxstatus code - It does so quickly
- No timeout / 500 / network error occurred
2) You’re receiving the same event more than once by design
Stripe webhooks are at-least-once delivery, not exactly-once.
That means:
- The same event can be delivered multiple times
- You must make your webhook handler idempotent
Use the event.id to deduplicate processed events in your database or cache.
3) You’re listening to overlapping events
You may be handling multiple event types that refer to the same underlying action. For example:
checkout.session.completedpayment_intent.succeededinvoice.paid
These may all happen for one payment and look like duplicates if you’re treating them as the same thing.
4) You have multiple webhook endpoints or multiple app instances
You might be:
- Registering the same endpoint twice in Stripe
- Running several servers without shared deduplication
- Using both local and production webhook listeners at the same time
5) Your local development setup is forwarding duplicates
If you use Stripe CLI or a tunnel like ngrok, you may be:
- Forwarding events to multiple local processes
- Restarting listeners and re-receiving the same events
- Testing with “replay” or resending events
6) You are processing the event before verifying or acknowledging it
If your code does expensive work before responding, Stripe may time out and retry.
Best practice:
- Verify signature
- Store/deduplicate event ID
- Respond
200quickly - Do the heavy work asynchronously
How to fix it
Make webhook handling idempotent
Store the Stripe event.id and skip it if already processed.
Example logic:
- Receive event
- Check if
event.idexists in your processed-events table - If yes, return
200 - If no, process it and save the ID
Inspect Stripe Dashboard
In the Stripe Dashboard:
- Go to Developers → Webhooks
- Click your endpoint
- Look at delivery attempts, response codes, and retry history
If you want, I can help you diagnose the exact cause if you share:
- your webhook event type(s)
- your handler code
- whether you’re using Stripe CLI, ngrok, or production webhooks
Brands