Skip to main content
After verifying the signature, process the event asynchronously. Your endpoint must return 2xx within 30 seconds — PayGrid retries on failure or timeout.

Handler flow

Recommended pattern:
Receive POST → verify signature on raw body → return 200 OK → process in background

Handler checklist

  1. Verify the signature on the raw request body (not re-serialized JSON).
  2. Return 2xx within 30 seconds — queue or background-task business logic.
  3. Deduplicate webhooks by event_id; deduplicate callbacks by transaction_id.
  4. Confirm data.amount, data.currency, and merchant_reference match your order.
  5. Act on the event type (see below).

Deduplication

Notification typeDedup keyNotes
Webhookevent_idOne per status transition; stable across retries
Callbacktransaction_idOne callback per payment
On retries, PayGrid re-sends the same payload with the same event_id, but X-MeetPay-Delivery-ID changes per attempt. Store processed event_id values and skip duplicates.

Validate the payment

Before fulfilling an order:
  • Confirm transaction_id or merchant_reference maps to a real order in your system.
  • Match data.amount and data.currency (webhooks) or amount and currency (callbacks) to what you initiated.
  • Reject or flag mismatches — do not fulfill on amount/currency drift.

Actions by event

EventAction
webhook.testVerify signature only; return 200 — do not fulfill orders
payment.completedFulfill order, mark paid, credit user
payment.failedCancel order, release reserved stock, notify customer
payment.expiredCancel order, release reserved stock
payment.cancelledCancel order, release reserved stock
payment.processingOptional: update UI to “processing” (rare for mobile)
Don’t assume an intermediate event will precede the terminal one. Only advance your internal order status forward — never backward.

Retries and polling fallback

ScenarioBehavior
Your endpoint returns non-2xx or times outPayGrid retries automatically (up to 5 attempts per delivery)
Retry delays~30s → 2m → 10m → 1h between attempts
HTTP client timeoutPayGrid waits up to 30 seconds per delivery attempt for your response
Retries exhaustedDelivery is dead-lettered; PayGrid notifies you by email — recover via polling
Missed webhookGET /api/v1/payments/{id} or POST /api/v1/payments/{id}/refresh
Design handlers to be idempotent — the same event_id may arrive more than once.

Track payments

Polling, status values, and listing payments
Next step: Payload reference