All Insights
FinTech & Payments2026-10-28 · 6 min read

Designing Bulletproof Payment Webhooks Across Razorpay, PayU, UPIGateway & Crypto

How to unify Indian fiat gateways and BEP20/CoinPayments flows behind one signature-verified, idempotent settlement pipeline.

1. Treat Frontend Callbacks as Hints, Never Truth

Users frequently close mobile browsers right after completing a UPI intent or card 3DS flow. Your backend must treat client redirect responses purely as UI hints and rely on server-to-server webhook verification.

2. Unified Gateway Adapter Pattern

Whether a payment arrives via Razorpay, PayU, UPIGateway, or CoinPayments, normalize the verified payload into a single internal `PaymentVerifiedEvent` before crediting orders or wallets.

// Normalized internal contract regardless of gateway
interface VerifiedPayment {
  gateway: "razorpay" | "payu" | "upigateway" | "coinpayments";
  externalTxId: string;
  orderId: string;
  amountMinor: number;
  currency: "INR" | "USD" | "USDT";
}

3. On-Chain Verification for BEP20 / Web3 Flows

For MetaMask or Trust Wallet transfers, always verify transaction finality, recipient contract address, and token decimals server-side before marking an invoice settled.

Need help building a system like this?

Book a Call