Comparing B2B and B2C eCommerce API Integrations
An eCommerce business connects its storefront to the systems that manage products, prices, inventory, orders, payments, and delivery. APIs, or application programming…
When one service needs to notify another that something happened, it can send a webhook: an HTTP request containing event details. Networks fail, receivers go offline, and responses get lost, so a sender cannot assume that one request reaches the receiver exactly once. Reliable delivery needs several safeguards. Retries give failed requests another chance. Signatures help the receiver check who sent a request and whether its contents changed. Idempotency means that processing the same event again does not repeat its business effects.
A dependable design stores each event before sending or acknowledging it. The receiver checks each request using the sender’s documented signature format and makes event processing safe to repeat. The sender and receiver also need a way to recover events that still fail after automatic retries stop.
A successful HTTP response should mean the receiver has safely accepted the event. It does not have to mean that every downstream action has finished. The receiver can store the verified event or place it on a queue that keeps messages until they are processed. It can then return a success response and process the event in the background.
That order matters. If the receiver returns success before recording the event, a crash could erase the event after the sender stops retrying. If the receiver finishes all business work before responding, a slow downstream service could cause a timeout. The sender may then repeat a request even though the receiver already made the change.
The receiver should therefore verify the request, check that the event is valid, and save it reliably before returning success. If the durable write fails, it should return an unsuccessful response so the sender can follow its retry policy. The response codes that trigger retries depend on the provider, so check its delivery documentation rather than assuming every sender treats status codes the same way.
The sender also needs durable storage. It should record an event before attempting delivery so it can retry or recover the event after a crash. A transactional outbox coordinates saving a business change with saving its outgoing event. The sender records both in the same database transaction, then a dispatcher sends the event.
For more on receiver-side handling, see building reliable webhook receivers.
Retries improve the chance that a request reaches a temporarily unavailable receiver, but providers set different limits. Amazon EventBridge rule targets, for example, default to up to 185 attempts over 24 hours, using exponential backoff, which increases the delay between attempts, and jitter, which adds random variation to those delays. After attempts run out, EventBridge drops the delivery unless the sender has configured a dead-letter queue, a place to store messages that could not be delivered. Those figures apply to the documented rule-target configuration; other EventBridge features have different settings. See EventBridge’s rule-target retry policy.
PayPal documents up to 25 attempts over three days after a non-2xx response. GitHub, by contrast, requires a successful response within 10 seconds and does not automatically redeliver failed deliveries; users can request redelivery manually. The PayPal webhook overview and GitHub webhook best practices show why a receiver must learn each provider’s specific response and recovery rules.
If you build the sender, retry temporary failures with exponential backoff and jitter. Set a limit on how long retries continue, and keep events that reach that limit so someone can inspect or send them again. If you build the receiver, return success only after durable acceptance and keep the request handler fast. A timeout does not prove that the receiver did nothing: it might have saved the event and lost its response on the way back. That uncertainty makes duplicate-safe processing essential.
A webhook signature is a cryptographic value the receiver checks against the request. The sender creates it from the request contents and a shared secret or private key, so the receiver can check whether the contents match what the sender signed. A common approach uses an HMAC, a keyed hash calculated from a message and secret. A valid signature helps the receiver confirm who sent the request and that its signed contents have not changed; it does not encrypt the request, so use HTTPS to protect data in transit.
Verify the exact bytes the sender signed. Parsing JSON and then creating it again can change spaces, field order, or encoding. Those changes can make a valid signature check fail. Read and retain the raw request body before middleware transforms it, then use the provider’s documented verification library or signing procedure. Providers differ in the headers, algorithms, encodings, and request fields they sign. The Standard Webhooks specification and OWASP webhook security guidance describe these differences and the raw-body requirement.
Use a constant-time comparison when comparing signatures so the comparison does not reveal information based on how many leading characters match. Keep signing secrets in a secret store, and plan rotations so the receiver can accept signatures made with the old and new secrets during an overlap period when the provider’s protocol supports it. GitHub’s signature validation instructions cover its specific signature format and comparison guidance.
Some providers include a signed timestamp. The receiver can check whether the timestamp falls within the time range the provider accepts for recent requests. This lets the receiver reject old requests that someone captured and sent again. The timestamp must be part of the signed data for this check to be meaningful. Follow the provider’s documented tolerance rather than applying one universal time window.
Idempotency means that processing the same event more than once produces the same intended result as processing it once. Retries and manual redelivery make duplicates normal, and a lost response can produce a duplicate even when the receiver completed the first attempt.
Use a stable event ID to recognize duplicates, and make sure durable storage cannot record the same ID twice. When the receiver sees an event it has already recorded, it should avoid scheduling the same business work again and acknowledge the delivery according to the provider’s rules. Store processing state alongside the event so a worker restart does not leave the receiver unable to tell whether an event was accepted, completed, or interrupted.
Do not assume every delivery identifier is covered by the signature. OWASP notes that GitHub signs the raw request body, not its X-GitHub-Delivery header. That header identifies ordinary redeliveries, but it is not authenticated by the body signature. Prefer a stable event identifier inside signed content when the provider supplies one; otherwise, understand what the provider’s delivery ID does and does not prove before using it as the sole deduplication key.
Deduplication does not solve event ordering. GitHub documents that webhook deliveries can arrive in a different order from the events themselves. When order affects correctness, use sequence or version information from the provider if it is available. Otherwise, retrieve the provider’s current version of the resource, which is the source of truth. The appropriate choice depends on what each event contains.
Automatic retries eventually stop, and some providers require manual redelivery. The sender should keep delivery attempts and responses so operators can troubleshoot failures. The receiver should provide enough information to find events it accepted but has not finished processing. A dead-letter queue or equivalent durable store gives operators a place to inspect and recover events that exhausted retries.
Track which deliveries succeed, how many times the sender retries, how long deliveries take, and how long the oldest unprocessed event has waited. Also monitor signature failures and duplicate counts: a sudden increase in signature failures can point to a secret or configuration mismatch, while a growing queue age can show that workers are falling behind. AWS recommends monitoring invocation and retry metrics and, where configured, failed invocations and dead-letter queue deliveries in its EventBridge monitoring guidance.
Test recovery as well as the normal path. Confirm that the receiver handles an invalid signature without processing the event, that a repeated event does not repeat side effects, and that an operator can find and replay a failed delivery. For the sender, document the retry horizon and what happens after it ends. For more on delivery outcomes and guarantees, see what webhook delivery guarantees mean.
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com