The Webhook Fired Twice. You Just Paid Your Supplier Twice for the Same Order.
A webhook is an automated message one service sends another when something happens, such as a payment being captured. The article describes these messages as events delivered to a receiving system. When a webhook fires twice, the same event reaches that system more than once. That does not necessarily mean the customer ordered twice. For example, a customer checks out once, but the payment service sends the same event again because its first response was late or never arrived. If the store treats each delivery as a fresh instruction, it might create another invoice or push another purchase to the supplier. The customer still placed only one order. Repeated delivery is a normal possibility in systems built for at-least-once delivery. The article says Stripe may retry when an endpoint does not return success within 20 seconds. A receiver needs to record event IDs and check the store order’s supplier status before acting, so a repeat does not repeat the business action.
What is a webhook, and what does it mean for one to fire twice?
A webhook is an automated message one service sends another when something happens, such as a payment being captured. The article describes these messages as events delivered to a receiving system. When a webhook fires twice, the same event reaches that system more than once. That does not necessarily mean the customer ordered twice.
For example, a customer checks out once, but the payment service sends the same event again because its first response was late or never arrived. If the store treats each delivery as a fresh instruction, it might create another invoice or push another purchase to the supplier. The customer still placed only one order.
Repeated delivery is a normal possibility in systems built for at-least-once delivery. The article says Stripe may retry when an endpoint does not return success within 20 seconds. A receiver needs to record event IDs and check the store order’s supplier status before acting, so a repeat does not repeat the business action.
In the article’s example of 200 orders, how many duplicate supplier purchases could result if 2% of payment events are delivered twice?
If 2% of 200 payment events are delivered twice, 2% of 200 is four events. Each of those four has one additional delivery. If the store treats each repeat as a fresh instruction and pushes the order again, the result could be four duplicate supplier purchases.
The key point is that a repeated event is not a new customer order. In the article’s example, the customer checks out once, but an event delivered again can make the receiving system repeat its work. For a dropshipping store, that work may be a real purchase from the supplier, not just another database entry.
This is a conditional calculation, not a figure reported in the article: it assumes every repeated event triggers another supplier purchase. The article gives no 200-order example. It recommends recording event IDs and checking whether the store order already has a supplier order number before pushing again.
Why might a payment service resend an event even when the store has already processed it?
A payment service can resend an event when it does not receive a success response from the store in time. The article says Stripe retries if its endpoint takes more than 20 seconds to return success. A slow database write, sluggish index, or proxy timeout can all delay the reply.
The tricky part is that the store may have finished processing the payment event even though its response did not reach the sender. From the sender’s point of view, the delivery may have failed, so it sends the same event ID again. Without a record on the receiving side, that repeat can look like a new instruction.
The article says Stripe’s webhook delivery is at-least-once, not exactly-once, and that it retries up to three times by default. A receiver should save the source and event ID with a unique database constraint. Then it can acknowledge a repeat without running the business action again.
What can happen when a repeated event triggers a second supplier purchase?
A repeated event can trigger a second purchase from the supplier, even though the customer placed only one order. In a dropshipping setup, that is not just a bookkeeping error: the store has spent money with a third party, and the supplier may ship both orders.
The article’s opening example is a single customer checkout that becomes two supplier orders, two charges to the store, and two identical parcels heading to the customer. The problem can start when an event is retried after a timeout, when multiple triggers push the same order, or when an operator manually resends it.
Once the supplier has two orders, the store may need to handle a return or discuss refusing a parcel across two platforms. That is harder than correcting an entry in the store’s own database. The article recommends checking whether a supplier order already exists before pushing, and recording each attempt’s state and response.
Why can checking only the webhook’s event ID fail to prevent two supplier orders for the same store order?
An event ID guard helps when the sender retries the same event. But it does not establish that two different events refer to different customer orders. A sender may create a new event for the same underlying action, or the store may have two triggers for one order.
For example, an order-created event and an order-paid event could both prompt a supplier push. Because their event IDs differ, a log that only rejects previously seen IDs may accept both. The article also notes that a cron job and an event, or a retry after a timeout, can overlap and create another push.
The store order needs its own durable identity check. The article recommends storing the supplier order ID against the store order and checking for it before any push. If that supplier order number is already present, return the existing result instead of making another purchase. This guard handles repeats that event-level checks cannot catch.
What is idempotency, and how can it stop a repeated instruction from causing a second purchase?
An operation is idempotent when running it twice produces the same outcome as running it once. This matters because integrations can deliver an instruction more than once, and a receiver may not know whether an earlier attempt succeeded. Without a guard, processing the repeat can create a second real-world action.
For a supplier push, the store can save the supplier order ID against the store order. Before purchasing, it checks whether that order already has a supplier order number. If one exists, the system returns that result rather than sending another purchase. A unique event log adds another guard for retries of the same event.
The article recommends applying idempotency at each boundary, rather than rebuilding the stack. It also calls for recording push attempts and their states, payloads, responses, and attempt counts. Together, these checks make repeats safer and help operators distinguish a completed push from a failure that needs attention.
When a supplier request times out, why is checking whether the order already exists safer than sending the request again?
A timeout means the store did not get a clear response; it does not prove the supplier never received the request. The article specifically warns that after a timeout, the first push may actually have succeeded. Sending the request again without checking can therefore create a second purchase.
The safer move is to inspect whether the supplier order already exists for that store order before pushing again. The article recommends storing the supplier order ID against the store order and asking whether that order already has a supplier order number. If it does, return the existing result rather than purchasing again.
The article also says to record each attempt’s state, payload, response, and attempt count, and to distinguish temporary timeouts from permanent rejections. That makes the stuck state inspectable instead of encouraging a manual resend. The provided text does not specify a detailed procedure for resolving an uncertain timeout, but it makes clear that blindly retrying risks a duplicate.
This brief was written by AI from the original reporting and checked by other models. Names, figures and quotes come from the source; read it for full context.
Read more in the JupiteX app
Pulse is free. New stories every 4 hours, each one broken into the questions that explain it.
Or read more news on the web