Webhook Delivery Guarantees (Dispatcher v2.0) & Idempotent Order Reconciliation

Operational architecture behind UPIGateway-Webhook-Dispatcher/2.0, bounded 8-second delivery timeouts, PostgreSQL audit logging, and resilient dual webhook + polling patterns.

Deterministic Webhook Dispatch & Audit Visibility

Every verified transaction dispatches an outbound JSON webhook signed with `User-Agent: UPIGateway-Webhook-Dispatcher/2.0` under a strict 8,000ms `AbortController` timeout. Delivery attempts, HTTP status codes, truncated response previews, and network failure diagnostics are recorded into `webhook_logs` for merchant debugging.

{
  "status": "SUCCESS",
  "order_id": "ORD_1732948102",
  "customer_mobile": "9876543210",
  "amount": "499",
  "remark1": "Pro Subscription",
  "remark2": "tenant_99",
  "utr": "433412345678",
  "date": "2026-11-30T08:15:00.000Z"
}

Dual Reconciliation: Combining Webhooks with Active Polling

  • Acknowledge incoming webhook POST requests with `HTTP 200 OK` within 2 seconds before performing heavy downstream database work.
  • Configure a return handler on your `redirect_url` page that triggers `POST /api/check-order-status` so buyers never stall if a merchant server temporarily dropped an incoming webhook.
  • Guard wallet top-ups with an atomic database update (`WHERE order_id = $1 AND status = 'PENDING'`) so webhook + polling races credit the customer exactly once.