Written by 4SYSTEMPublished on Updated on
7 min read
How to separate receipt from business processing, withstand duplicate deliveries and recover after an outage without repeating actions.
- Distinguish delivery, event and business action
- Assign a responsibility to each stage
- Build separate reception and processing stages
- Fictional example: creating a fulfilment task only once
- Prepare for incidents and reconciliation
- Frequently asked questions
- Describe guarantees before connecting tools
- Sources
To make ecommerce webhooks reliable, verify the signature, durably record the delivery before acknowledging receipt and protect actions against duplication. A webhook is a notification sent to your application; receiving it does not prove that an order has been processed. Shopify documents repeated deliveries, and Stripe states that event arrival order is not guaranteed.[1][3] Design the workflow to withstand repetition, delay and interruption.
Distinguish delivery, event and business action
The delivery is the request received. The event is what happened on the platform. The business action is what your system decides to do about it: update a status, create a fulfilment task or forward a request. These identities are not interchangeable. Shopify documentation distinguishes X-Shopify-Webhook-Id for deduplicating deliveries from X-Shopify-Event-Id for correlating several deliveries originating from the same merchant action.[1]
Also define which system is authoritative for each piece of data. An old notification must not blindly overwrite a more recent state. Depending on the need, processing can retrieve the current object from the platform and decide whether the action is still relevant. Identifiers, account scope and format version belong in the integration contract. This precision is more useful than a general promise ofmarketing automation.
Assign a responsibility to each stage
A clear architecture separates rapid request reception from work that may take time. Shopify recommends queuing to absorb traffic bursts; Stripe also recommends asynchronous processing.[1][3] The following grid describes design responsibilities, not a guarantee automatically supplied by a library.
| Webhook stage | Responsibility | Technical evidence to retain |
|---|---|---|
| Receiving a webhook | Verify the origin and expected format | Validation result and identifier |
| Recording | Retain a durable task and its state | Task identifier and receipt time |
| Processing | Apply an action without repeated effects | Business key and operation result |
| Recovery after an incident | Revisit incomplete tasks | Attempt history and failure reason |
Build separate reception and processing stages
The signature must be checked against the raw body before any transformation changes it. Shopify and Stripe specify this in their respective documentation.[1][3] Use official tools suited to your environment and keep secrets out of logs. A valid signature does not remove the need for duplicate checks or business rules.
- Receive the request, preserve the raw body and verify the signature according to the supplier’s exact contract. Reject invalid verification without starting a business action.
- Build a persistent identity including the supplier, relevant account and appropriate delivery or event identifier.
- Record the task with a uniqueness constraint. A simple lookup followed by a separate insertion leaves a possible race between concurrent requests.
- Acknowledge receipt only after that durable recording. If storage fails, do not claim to have accepted a task that could be lost.
- Have a separate worker process the task, with explicit states, work reservation and protection of the business action against repetition.
- Retain the outcome and arrange recovery for failed or abandoned tasks without indiscriminately rerunning all successful actions.
Delivery deduplication is insufficient if the process crashes after the external action but before recording it locally. For this case, provide an idempotency key accepted by the receiving system or a check of the effect already produced. Here, idempotency means repetition does not create an additional business effect. A local transaction alone cannot encompass an independent remote action.
Fictional example: creating a fulfilment task only once
Entirely fictional example: an event named evt-demo concerns order CMD-DEMO. The application receives a delivery, stores it and creates a fulfilment task. Another delivery arrives after a network interruption. The workflow recognises the identity already stored and does not create another business task. It can acknowledge receipt because the original work remains durably tracked, even if it has not finished yet.
If the logistics tool accepted the fulfilment task before a worker crash, recovery checks the business key associated with CMD-DEMO instead of sending another unchecked creation request. States must distinguish “received”, “in progress”, “succeeded” and “needs recovery”. This example makes no claim about a real application’s behaviour: each receiving system must be assessed for this protection.
Prepare for incidents and reconciliation
Supplier retries do not replace your recovery procedure. Shopify explains how to import missing data after downtime and check the relevant subscriptions.[2] Define a reconciliation window, the data to retrieve, recovery permissions and the final check. A sales notification must not automatically become proof of revenue in your event measurement plan.
- Plan a test with identical and concurrent deliveries: only one business action should result.
- Plan an interruption after storage, then after the external action, to check both recovery paths.
- Plan delayed or out-of-order events and check that the final state remains consistent with the source.
- Monitor task age, failures and reconciliation results, keeping logs limited to necessary data.
Frequently asked questions
Does a success response mean everything is finished?
No. It may mean the notification has been durably accepted for processing. Business status must be tracked separately. This distinction enables rapid reception without claiming that the logistics or accounting operation has already succeeded. Document exactly what your response commits you to.
Can the same identifier be used everywhere?
Not without checking its scope. An identifier may refer to a delivery, an event or a business object. Shopify notably distinguishes delivery identifiers from event correlation identifiers. The choice depends on the effect to protect and the integration scope, not just the header’s name.[1]
Does a queue guarantee exactly-once processing?
Do not assume so. The workflow must support recovery and protect the final effect, including after a failure between systems. Check storage, concurrency and the recipient’s idempotency separately. Error-free reception does not demonstrate this property end to end.
Describe guarantees before connecting tools
Reliable ecommerce webhooks require a clear identity, durable storage and actions whose outcome can be verified after an incident. Start with the scenario where repetition would be costly, then define evidence of receipt and success. To scope exchanges between your shop and business tools, 4SYSTEM services offer a starting point for discussing the integration contract and acceptance checks, without presenting an educational example as a universal connector.