Most payment events don't happen at the moment your server sends a request. A bank transfer settles hours later, a 3-D Secure check finishes in another window, a refund completes the next day. Webhooks are how the payment platform tells your system that something changed.
Five rules for reliable webhooks
- Verify the signature. Check that every webhook was signed by your payment provider before you act on it.
- Respond fast, process later. Return a success response as soon as you have stored the event, then process it in the background.
- Expect duplicates. Providers retry when they don't get a response. Use the event ID to make processing idempotent, so the same event never ships an order twice.
- Don't rely on order. Events can arrive out of sequence. Read the current state of the payment from the API when the order matters.
- Reconcile regularly. Once a day, compare your records with the provider's list of transactions to catch anything that slipped through.
Events you should always handle
- Payment succeeded and payment failed
- Refund completed
- Dispute opened and dispute closed
- Payout sent and payout failed
Test before you go live
Trigger every event type in a sandbox, including retries and failures. Most production incidents with payments come from an event type nobody tested.
Celmir's API sends signed, retried webhooks for every status change, with a sandbox to test them. Get sandbox access.