UPI Payment Webhooks Explained: How to Confirm Orders Without Duplicate Charges
I built the UroPay API after enough conversations with developers who all had the same complaint about payment gateways. The checkout looks fine in the demo, and then a customer pays twice for the same order because a webhook fired twice, or a payment succeeds on the bank's side and the merchant's system never finds out. If you're building UPI checkout into your own website or app, webhooks and order confirmation are the part that actually decides whether your payment flow holds up. Here's how I think about it, and how the UroPay API, one of the three products I run under the UroPay name alongside UroRelay and UroCentro, handles it.
What a payment gateway webhook actually does
A webhook is a message the payment gateway sends to your server the moment something happens to an order, usually that it's been paid, that it failed, or that it expired. Instead of your server sitting in a loop asking "is this paid yet?" every few seconds, the gateway pushes the answer to a URL you've registered. On the UroPay API, that's a signed HTTPS POST to your endpoint carrying the order status, and it fires on three events: PAID, FAILED, and EXPIRED.
The part developers new to this miss is that a webhook is advisory, not a guarantee. Networks drop packets, servers restart mid-request, and gateways retry deliveries that don't get a clean response. NPCI's own numbers show why this matters at scale. UPI processed 23.66 billion transactions in July 2026 alone, averaging 763 million payments a day (Business Standard). At that volume, "rare" edge cases like duplicate deliveries or out-of-order events happen constantly. Just maybe not to you, until they do. Your code has to assume they will eventually.
That's why the UroPay API pairs every webhook with a GET on the order itself, which is the authoritative source of truth. The webhook tells you to go check. The order lookup tells you what's actually true. Treat the webhook as a nudge and not a fact, and you'll sidestep most of the bugs that come from trusting network delivery blindly.
Why idempotency matters more than the webhook itself
Idempotency is a simple idea with an intimidating name. Running the same operation twice should produce the same result as running it once. Applied to payments, that means if your webhook handler receives the same PAID event twice, which it will sooner or later, your code should not ship the product twice, send two confirmation emails, or credit a wallet balance twice.
Payment gateways build retries into webhook delivery on purpose. If your endpoint doesn't respond with a 2xx status inside a short window, most gateways assume the delivery failed and try again. Razorpay's own webhook documentation tells developers to check a unique event ID before processing anything, because "your endpoint might receive the same webhook event multiple times" as expected behavior, not a bug (Razorpay Docs). Every serious payment gateway works this way, the UroPay API included.
The fix is to key off something stable. On the UroPay API, that's your own tenantOrderRef, the reference you pass when you create the order. It's what the API uses as the idempotency key on creation, and it shows up again on every webhook and status check tied to that order. Store processed event IDs, or order references, in your database, and before you act on an incoming webhook, check whether you've already handled it. If you have, acknowledge it and stop. If you haven't, process it and record that you did. That's the whole pattern, and it's the same one a payment engineering guide covering webhooks and idempotency recommends across gateways generally, not just UroPay's (Appricotsoft).
The two-call pattern behind the UroPay API
The UroPay API is deliberately small: one endpoint to create an order, one to check its status, plus the webhook. You call POST /v1/orders with your tenantOrderRef, an amount, and a currency. The response gives you an order ID and an openUrl. Send your customer there, and checkout hands off to whichever UPI app they already have: Google Pay, PhonePe, Paytm, BHIM, or Amazon Pay.
From that point, two things happen at once. Your customer completes or abandons the payment in their UPI app, and your server waits to hear back. The signed webhook usually arrives within seconds of a successful payment, but your code shouldn't depend on "usually." When it arrives, verify the signature, check whether you've already processed that tenantOrderRef, and if not, call GET on the order to confirm the status directly before you do anything irreversible, like releasing a download or unlocking access.
One developer using UroPay across several client platforms described it this way in a review on the UroPay site: the webhook system "makes automating order fulfillment a breeze," and what stood out to him wasn't just the pricing model but that support actually answers when something needs troubleshooting. A webhook you can build automation around, plus a person to ask when it misbehaves, is worth more in production than it sounds on a features page.
You also get two separate key pairs from the start, one TEST and one PRODUCTION, and the key you sign a request with decides which environment it hits. That matters more than it sounds like it should, because you can build and break your webhook handler against sandbox orders as many times as you need, long before a real customer's money is anywhere near it. I'd rather a developer spend a day deliberately triggering FAILED and EXPIRED events in TEST than find out their handler mishandles them the first time it happens live.
Reconciliation: your safety net when webhooks fail
Even a well-built webhook handler will occasionally miss an event. Your server could be mid-deploy, a load balancer could be draining connections, or a network blip could eat the delivery entirely. This is where a lot of integrations quietly fall apart: everything works in testing, and then six weeks into production, a customer emails asking where their order went, and nobody can explain why the webhook never showed up.
The fix is a small reconciliation job, and it doesn't need to be clever. Once a day, or once an hour if your volume justifies it, pull a list of orders you created in the last window and call GET on any that are still sitting in a pending state in your own database. Compare that against what UroPay's API says the order's actual status is. Anything that's PAID on UroPay's side but still pending on yours is a webhook that got lost, and your reconciliation job can quietly finish the job the webhook was supposed to do. This pattern, server-side status verification running alongside webhook delivery, shows up across the payments industry generally, because webhook delivery is inherently best-effort no matter which gateway sends it.
Run that job even if your webhook handler has never dropped an event that you know of. The value of reconciliation isn't catching problems you've already seen. It's catching the one you haven't, before a customer has to tell you about it.
Building an idempotent webhook handler, step by step
Here's the pattern I'd tell any developer to follow, regardless of which gateway they're integrating.
First, verify the signature before you touch the payload. The UroPay API signs requests with HMAC-SHA256, and your webhook endpoint should recompute that signature against the raw request body and compare it to the header before parsing anything. Skip this step and anyone who finds your webhook URL can post a fake PAID event and get a free order.
Second, extract the order reference and check your own database for it. A row that says "already processed" means you return a 2xx immediately and do nothing else. This one check eliminates almost every duplicate-processing bug in production payment code.
Third, if the reference is new, don't trust the webhook payload's status blindly. Call GET on the order to pull the authoritative state instead. It costs you one extra API call, and it saves you from acting on a stale or spoofed webhook.
Fourth, process the order and write the "already processed" record in the same transaction, or as close to it as your database allows. If those two things aren't atomic, a crash between them reopens the exact race condition you were trying to close.
Fifth, respond quickly. Razorpay's guidance to return a 2xx within five seconds, and Cashfree's and PayU's equivalent guidance in their own webhook documentation, exist for the same reason: a slow handler looks like a failure to the gateway, which triggers a retry, which is more duplicate traffic to defend against. Acknowledge fast, and push the slow work, emails, fulfillment, notifications, to a background job.
UroPay API vs traditional payment gateway APIs
| UroPay API | Typical aggregator API (Razorpay / Cashfree / PayU) | |
|---|---|---|
| Commission | 5% + ₹5 with KYC, 10% + ₹5 without | Roughly 2% + GST, KYC required either way |
| KYC to go live | Optional, start on the 10% + ₹5 tier without it | Mandatory before any live transaction |
| Settlement | T+3 with KYC, T+5 without | Typically T+1 to T+3 |
| Webhook design | Signed, best-effort delivery keyed to your own tenantOrderRef, plus an authoritative GET lookup | Signed, best-effort delivery with gateway-issued event IDs, plus a status API |
| Who owns the checkout | You do: your domain, your UI | You do, if you skip their hosted checkout page |
| Support model | Direct email to the founder, gaurav@uropay.me | Ticket queues, with priority support often gated to higher plans |
| Category restrictions | 44 prohibited categories, case-by-case audit for edge cases | Stricter, more automated risk scoring that often declines or stalls unusual categories |
The technical shape of the integration (sign a request, create an order, listen for a webhook, verify with a status call) is close to identical across all of these. What differs is price, how much paperwork stands between you and your first transaction, and who you're talking to when something breaks. I'll be direct about the first one: the UroPay API's commission is higher than what Razorpay, Cashfree, or PayU quote on their pricing pages. There's no version of the math where 5% or 10% beats 2%. If your business already has clean KYC documents, an established category, and volume where every basis point counts, a mainstream aggregator is probably the cheaper choice, and I'd rather say that plainly than pretend otherwise.
What the commission actually buys you
Run the numbers on a ₹2,499 order. At the UroPay API's KYC tier, you pay 5% (₹124.95) plus ₹5, and keep roughly ₹2,369 after three working days. At the non-KYC tier, you pay 10% (₹249.90) plus ₹5, and keep about ₹2,244 after five working days. A mainstream aggregator charging 2% + GST would net you closer to ₹2,439, typically within one to three working days. On price alone, the aggregator wins at almost any volume.
So why would anyone pay more? Three reasons, and I'd rather state them plainly than dress them up. First, the non-KYC tier is a real path to going live without submitting PAN, GST, or bank-proof documents up front. It isn't a workaround free of any process; you still go through a website audit and sign a merchant contract. But the identity-document bottleneck that stalls applications elsewhere just isn't there. Second, every UroPay API merchant can reach me directly at gaurav@uropay.me, not a ticket queue that routes you to a human only once your volume justifies it. Third, I'm willing to onboard businesses in categories that bigger, more conservative aggregators slow-walk or decline outright, as long as you're not on the 44-category prohibited list. That list still applies, and some categories are hard no's regardless of KYC status, but the gray-area cases that get stuck in review elsewhere get an actual conversation here.
If your business sits comfortably inside a mainstream aggregator's risk appetite and your documents are ready, take the cheaper option. If you're in a category that keeps getting flagged, or you need to start collecting before your paperwork is in order, the premium buys you a real alternative instead of a "coming soon."
Setting up your first webhook with the UroPay API
Getting from zero to a working webhook takes about five working days end to end, most of it spent on the audit rather than the code.
You start by applying at dashboard.uropai.in with details about your business, your website or app, and your expected volumes. Next comes the website or app audit, where I check your product, pricing, refund and contact pages against the prohibited-category list. At that point you decide on KYC: submit documents now for the 5% + ₹5, T+3 tier, or skip that step and start on the 10% + ₹5, T+5 tier and upgrade whenever you're ready. Once that's settled, you sign the merchant contract covering commission, settlement, refunds, and chargeback liability, and I issue your live keys. You'll already have TEST keys from day one, since TEST and PRODUCTION are separate key pairs, so you can build and verify your webhook handler against sandbox orders before any real money moves. The integration itself is the two REST calls, POST /v1/orders to create and GET on the order for the authoritative check, using the signing and verification snippets in the API reference, which cover Node, Python, PHP, and cURL.
If your product doesn't need your own checkout at all, say you're a solo seller sharing a link on Instagram rather than a platform processing orders programmatically, the zero-commission, no-code route through UroRelay and its payment buttons or payment links is the faster and cheaper starting point. The UroPay API is still there waiting as the next step once you outgrow a hosted page.
Quick takeaways
- A webhook tells you to check an order's status; it isn't the status itself. Confirm with an authoritative
GETcall before acting on it. - Payment gateways retry webhook deliveries by design, so your handler will eventually see the same event more than once. Build for that from day one.
- Key your idempotency check off a stable reference (the UroPay API uses your
tenantOrderRef), not off request timing or arrival order. - The UroPay API's commission, 5% + ₹5 with KYC or 10% + ₹5 without, is higher than mainstream aggregators' roughly 2% + GST. There's no honest way to frame it as cheaper.
- What the premium buys: direct founder support at gaurav@uropay.me, a genuine non-KYC path to going live, and a real shot at onboarding for categories other aggregators decline.
- Verify webhook signatures before parsing the payload. An unverified webhook endpoint is an open door for fake "paid" events.
- Respond to webhooks fast and push slow work to the background, or you'll trigger the exact retries you're trying to handle gracefully.
Getting this right protects your customers as much as your revenue
A duplicate charge, or a payment that quietly vanishes into a support queue, is how a business loses a customer's trust, not just money on one transaction. The engineering here isn't complicated once you see the shape of it: verify the signature, check whether you've seen this order before, confirm with an authoritative status call, and only then act. Every payment gateway that takes reliability seriously, UroPay's included, is built around that same loop.
If you're building UPI checkout into your own product and want a rail that doesn't force you through a full KYC pile before your first transaction, the UroPay API gives you TEST keys today and live keys in about five working days. Start at dashboard.uropai.in, read the integration details in the API reference, and email me directly at gaurav@uropay.me if your webhook handler does something you can't explain. I'd rather answer that question myself than route you to a queue. If you want the broader context on how commission, KYC, and settlement fit together before you commit, the FAQ page and the blog cover most of what I get asked.
Frequently asked questions
Is a UPI payment webhook guaranteed to arrive?No. Webhooks are sent on a best-effort basis and can be delayed, duplicated, or occasionally dropped. Treat the webhook as a signal to check the order, not as final confirmation. The UroPay API's GET order-status endpoint is the authoritative source.
What does idempotent webhook handling mean in practice?It means your code produces the same outcome whether it processes a given event once or five times. In practice that's checking a stored order reference or event ID before acting, and skipping any event you've already handled.
How do I verify a UroPay API webhook is genuine?Recompute the HMAC-SHA256 signature over the raw request body using your webhook secret, and compare it to the signature header UroPay sends. Do this before you parse or trust anything in the payload.
Does the UroPay API require KYC before I can integrate webhooks?No. You can start on the non-KYC tier at 10% + ₹5 commission with T+5 settlement, using the same REST API, webhooks, and plugin as the KYC tier. Completing KYC later moves you to 5% + ₹5 and T+3 without a re-integration.
What happens if my webhook handler is down when a payment completes?The order still exists and its status is still queryable. Because the GET order endpoint is authoritative, a reconciliation job that polls recent orders will catch anything your webhook handler missed while it was offline.
Have you run into a duplicate-order bug from a payment webhook, or built a reconciliation job that saved you after an outage? I'd like to hear how you solved it. Reply, or pass this along to anyone on your team currently wiring up UPI payments.
References
- UPI transactions hit record 23.66 billion in July, value Rs 29.88 trillion, Business Standard
- Webhooks: best practices, Razorpay Docs
- Payment Gateway Integration Services: Webhooks and Idempotency for Reliable Payments, Appricotsoft
- RBI Introduces Consolidated Framework for Payment Aggregators, Cyril Amarchand Mangaldas
- UroPay API, product page






