What happens when an event fires
- You register an endpoint URL with the provider and choose the events you want.
- When one happens, the provider sends a POST request with a JSON payload describing it.
- Your endpoint checks that the request is genuine, stores it and replies quickly with a success status.
- A background job does the real work, such as marking the order paid and starting fulfilment.
- If your endpoint does not reply with success, most providers retry, usually with growing gaps between attempts.
Webhooks compared with polling
| Method | How it works | Trade-off |
|---|---|---|
| Polling | You ask the other system's API for changes on a timer | Simple, but delayed and wasteful when little changes |
| Webhook | The other system tells you when something happens | Close to real time, but your endpoint must be public, secure and always ready |
Many reliable integrations use both: webhooks for speed, and a scheduled check that catches any event that never arrived.
Duplicates, order and safety
Most providers deliver an event at least once, which means sometimes twice, and do not promise to deliver events in order. Record each event's ID and skip the ones you have already processed. When order matters, compare timestamps or fetch the current state of the record from the provider's API.
Anyone who learns your endpoint address can send it requests, so verify every one. Most providers sign the payload with a shared secret, often as an HMAC signature in a header. Check it, reject old timestamps to block replayed messages, and accept HTTPS only. For sensitive actions such as refunds, confirm the details through the provider's API before acting.
Common mistakes
- Doing slow work before replying, so the provider times out and sends the event again.
- Skipping signature checks because the address seems hidden.
- Assuming each event arrives exactly once and in order.
- No monitoring of failed deliveries, so customers discover the missed events first.
Webhooks are the usual trigger for workflow automation, and many iPaaS tools receive them for you.