How to keep duplicate webhooks from creating duplicate orders

An order leaves your storefront and reaches the warehouse. A few seconds later the storefront sends the same event again because it never received a response. The warehouse system sees a fresh request and creates a second pick ticket. This is a common shape for an integration failure. Two services each completed a step that looked reasonable from their own side, and nobody decided who would recognize a second delivery as part of the same business action.

Write down what a delivery is allowed to do

List each event you accept and the business change it is allowed to trigger. For a paid order, fulfillment might create a shipment request when the order is eligible to ship. For a refund, accounting might post an adjustment against an existing transaction. Include the provider event identifier, the business record identifier, and which system owns the current status. If the provider can emit two event types for the same transition, decide whether both are needed and where to recognize that they describe the same change.

Confirm how the provider retries, signs, and identifies events before writing the receiver. A provider can retry after a timeout, and a manual resend may also happen while automated retries are still active. Some providers deliver events out of order. Build the receiver around those conditions and document how it decides whether the business record has already moved past the incoming event. Stripe webhook delivery documentation

Save the delivery before you acknowledge it

A practical receiver verifies the sender’s signature, checks basic request requirements, and writes the delivery to a durable inbox or queue. It returns a successful response once that handoff has succeeded. Then a worker can read the delivery and make business changes in the background. Set an explicit retry policy for worker failures and give stalled deliveries an operator-visible state.

Use a unique database constraint on the provider and delivery identifier when those fields can identify a retry. A database constraint protects against two copies booking the same slot at the same time. Keep a second record of consequential actions keyed by a stable business identifier. For example, a fulfillment system might allow a single initial shipment request for each order and use a separate key for each legitimate split shipment. Keep the event payload and retention period proportionate to support needs and privacy requirements. GitHub webhook best practices

Decide how to recover from a partial success

In the warehouse example, the fulfillment API might create the shipment request while its response gets lost. Retrying the same action is safer if the downstream system accepts an idempotency key, a stable identifier for the intended effect. Store that value and use it again on retry. Make sure the downstream system scopes and retains the key long enough for your retry window.

Accelerate Your Engineering Velocity

Looking to scale your infrastructure, implement enterprise AI automation, or secure critical cloud dependencies? Partner with MyNew Technologies LLC to engineer robust technical systems built for enterprise efficiency.

Request Technical Consultation

When a downstream system has no equivalent, look up the external record using a stable reference before retrying. Where the result is uncertain and duplication is expensive, surface that case for investigation. A request ID and the last known state give an operator a concrete place to begin. Also decide how to handle a key reused with different input. Two requests may need manual review if they have the same key and disagree about a shipment address or quantity. AWS guidance on safe retries with idempotent APIs

Test a day when the connection misbehaves

In staging, deliver the same event twice. Then submit two copies together, deliver older and newer events out of order, and stop the worker after a downstream action succeeds. Check the warehouse or accounting records after each test. Confirm that operators can find stuck deliveries and replay one without accidentally creating a second charge, confirmation, or shipment. Test a failed signature as well and confirm that it produces no business action.

Give someone ownership of reconciliation. Compare order or fulfillment records at an interval that fits the time you can tolerate missing a delivery. A list of outstanding orders with their event status is often enough to let operations spot a gap before the warehouse closes for the day. A reliable release demonstrates that a delivery can fail, be retried, and arrive at the intended business outcome with a clear audit trail.

Need help? If your store, warehouse, or accounting system disagrees about which orders were processed, a systems integration consultation can help map the event flow, identify duplicated actions, and set recovery priorities.

Advertisement

Related

How we grouped 209 Magento log occurrences into 81 incidents

A case study from two Magento hosts shows how MNTNET Observability grouped 209 log occurrences, prepared 81 AI assessments, and recorded Slack alerts.

How to evaluate accessibility before buying business software

Add practical accessibility checks to software procurement so the team can evaluate the workflows employees and customers will actually use.

How to prepare a B2B storefront for a punchout catalog

Explore the buyer, supplier, and order workflows to test before connecting a B2B storefront to a purchasing system.

How to test cloud portability before it matters

Run an exit rehearsal to see which parts of a cloud application move easily and where your team needs a documented migration plan.

How to decide where to run AI inference

Compare hosted and self-managed AI inference using representative requests, accepted outputs, peak demand, and ownership costs.