Payments Analysis · Global
How to replay Stripe webhooks without fulfilling an order twice
Test duplicate delivery, out-of-order events and worker restarts before trusting your checkout automation.
By Launchr Space ·
Imagine a paid order whose parcel is packed twice. Both jobs started with a valid Stripe webhook. The first worker created the shipment, then died before recording that it had finished. A retry reached a different worker, which read the same paid invoice and created a second shipment. A green webhook dashboard does not tell you whether your application can survive that sequence.
Separate a delivery from the work it requests
Stripe documents two behaviors worth designing for: events can be delivered more than once, and events are not guaranteed to arrive in generation order. Verify the signature against the raw request body before trusting the event. Store the event ID in a durable inbox with a uniqueness constraint. Acknowledge the request after the inbox transaction commits, then let a worker handle fulfillment. If the database is down before that commit, don't acknowledge the event as accepted.
Give the business action its own key
A webhook inbox identifies a repeat delivery, not every repeat business action. Two distinct events can both appear to authorize the same shipment. Give the action a key that reflects your own rules, such as one initial shipment per order ID. Use a unique action record and, if your shipping provider offers it, pass a stable idempotency key when calling its API. If the provider cannot deduplicate and a request times out, look up the result or queue it for reconciliation instead of assuming that it failed.
Test the failure, not just the happy path
In test mode, deliver the same event twice, then deliver the paid signal before a preceding invoice event. Check that the application can retrieve the current object when it needs to rather than waiting forever for an earlier event. Stop a worker after the provider has accepted a request but before the local completion update. Start it again and check that you still have one shipment. Save the final order state and provider reference as test evidence. The goal isn't to make every event run exactly once. It's to make the customer-visible action safe to retry.