Stork Delivery

What happens after the webhook arrives?

Receiving an event is only the start. A useful webhook integration also handles persistence, duplicates, ordering, and recovery.

Color-coded network cables plugged into a panel.
Photo: Brett Sayles / Pexels

The problem: receiving an event does not complete the business action

A payment provider sends a webhook. Your endpoint returns a successful response. The dashboard turns green.

Has the customer actually received the right order status?

That depends on everything after receipt: checking the message, recording it, processing the business change, and detecting any failure along the way.

A practical approach

Accept the event responsibly

Verify the request using the provider's documented method. Keep the original request body available when signature verification requires it. Then durably record the accepted event or enqueue it before acknowledging work that still needs to happen.

Keep the endpoint fast, but do not confuse a quick response with completed processing. An in-memory task can disappear when a process restarts.

The Stripe webhook documentation explains provider-specific handling, including signatures, repeated deliveries, and event-ordering considerations. Other providers have their own contracts, so check those rather than assuming they behave identically.

Expect repeated and delayed information

A repeated delivery should not create a second business action. Track the relevant event identity and make the downstream operation safe to repeat where possible.

Also decide how an older event interacts with a newer state. If an order has already been refunded, a delayed payment notification should not casually move it back into an earlier state.

Sometimes processing requires looking up the authoritative record rather than treating the notification as a complete current snapshot. That choice should follow the provider's API and your business rules.

Keep failures recoverable

Separate an invalid message from a temporary processing failure. An unavailable database may justify a retry. A message with an unknown account reference may need investigation.

Give unresolved events a visible location with their failure reason and a controlled replay mechanism. Record the result of the replay so operators can tell whether it fixed the problem.

Avoid exposing sensitive payloads broadly just to make troubleshooting convenient. Keep useful identifiers in operational views and restrict access to detailed data.

Reconcile the outcome

A webhook pipeline should be checked against the business records it is meant to update. Look for accepted payments without the expected order state, or completed shipments without a customer-visible update.

That comparison catches problems a healthy endpoint cannot see. The useful measure is whether the intended workflow finished, including the cases that arrived twice, arrived late, or needed a second attempt.

The result: events that reach a verified business outcome

Choose one event type and trace it from signature verification through durable receipt to the destination record. Test a duplicate, a delayed event, and a temporary downstream failure. Each should end in the intended state or an assigned exception that can be resolved safely. Use a reconciliation of source and destination records to confirm that accepted events have not disappeared between steps.

← Explore the library