Learn3 min readGaisPay team

Webhook security, done right

Four rules for receiving payment webhooks safely — and the code to follow them.

1. Verify the signature

Anyone can send a POST to your URL. Compute the HMAC of the raw body with your secret and compare it in constant time.

2. Check the timestamp

Reject signatures older than a few minutes to stop replayed requests.

3. Be idempotent

Webhooks are retried. Store the delivery ID or check your order status so an order is fulfilled once.

4. Answer fast

Return 2xx quickly and do the work in a background job. GaisPay waits 10 seconds before treating a delivery as failed.

Ready-to-use code for Node.js, PHP and Python is in the webhook guide.

Related

Start accepting crypto payments.

Apply in minutes, complete business verification and share your first payment link. Our team helps you go live.