Skip to content
99tests Blog
Testing guides

How to Test a UPI Payment Flow: Intent, Pending and Refunds

A practical way to test a UPI payment flow on real phones, from the intent handover and pending payments to app restarts, refunds and three-way reconciliation.

In this article
  1. What a UPI payment passes through
  2. How to test a UPI payment flow: the short version
  3. What a sandbox can tell you, and what it cannot
  4. Intent, QR and collect: test each way of paying you offer
  5. Android and iPhone hand over differently
  6. Test every end state, not only success
  7. The pending state: money debited, order not placed
  8. App switching and weak networks: where budget phones break the flow
  9. Refunds and the three records
  10. A worked example: one payment on five phones
  11. How to test a UPI payment flow before every release
  12. Frequently asked questions

At 9:12 pm in Bhopal, Ritu pays ₹1,249 for groceries from a delivery app on her Redmi 13C. The app hands her over to PhonePe, she enters her UPI PIN, and a green tick appears. Her bank's SMS confirms the debit a few seconds later.

She switches back to the grocery app. It has restarted and shows her cart, still full, with the Pay ₹1,249 button waiting. There is no order and no message. She taps Pay again, and by 9:14 pm she has paid ₹2,498 for one bag of groceries.

The team had tested this payment. They ran success and failure in the gateway's sandbox, on a developer's Pixel on office Wi-Fi, where the app never restarts and the answer arrives within a second. This guide shows how to test a UPI payment flow the way customers meet it: on their own phone, with their own UPI app, when the bank answers late or the answer never reaches your app.

What a UPI payment passes through

A UPI payment made from a merchant app is a relay with six legs, and your app runs only the first and the last. In between, the customer is inside another company's app, the money moves between two banks through the switch run by the National Payments Corporation of India (NPCI), and the answer has to find its way back to a phone and to a server.

LegWhat can go wrongWhat the customer sees
1. Order and payment requestWrong amount, or two requests for one cartTwo payment attempts for one order
2. Handover to a UPI appNo UPI app found, or the wrong one opens"No app found", or an error inside the UPI app
3. Approval in the UPI appWrong PIN, low balance, limit crossed, customer backs outA failure there, then a confused merchant app
4. The banks and the NPCI switchA bank is slow or down; debit done, credit not confirmedMoney gone, no confirmation
5. The answer comes backApp restarted, customer never returns, server message late or repeatedA spinner, a full cart, or "payment failed" after a debit
6. Result and orderOrder missing, or created twicePaid with no order, or two orders

Leg 4 has its own clock. NPCI's consolidated UPI circular, issued in September 2026, lists a response time of 15 seconds for the banks' debit and credit messages and 10 seconds for a status check. A healthy payment can therefore outlast the few seconds a checkout screen is willing to wait, and legs 5 and 6 are where apps handle that badly.

How to test a UPI payment flow: the short version

  1. Get two environments. The gateway's sandbox for forcing outcomes, and a build where real rupees move.
  2. Prepare the accounts. Two bank accounts, one kept nearly empty, and two or three UPI apps registered on the test phones.
  3. Pick the phones. At least one budget Redmi, one Realme or Vivo, one Samsung and one iPhone, spread across Jio, Airtel and Vi.
  4. Walk every end state. Success, wrong PIN, low balance, cancelled, expired and pending, on each way of paying you offer.
  5. Reconcile three records for every attempt: the bank's, the UPI app's and your own order system's.

Practical rule: a UPI test passes only when three records agree: the bank's SMS or statement, the UPI app's history and your order screen. A green tick on one of them proves nothing about the other two.

If you would rather start from a ready list, our free UPI payment test cases cover 40 cases, from the happy path to network drops. If you are writing your own, the fields each case needs are in format for test cases.

What a sandbox can tell you, and what it cannot

Payment gateways offer a test mode, and it is the right place to start. In it, the gateway plays the bank. Razorpay's test page for UPI collect, for example, lets the UPI ID and the amount you send decide the outcome: success, a bank technical error, insufficient funds, a wrong PIN, an expired request or a cancellation. The same page is plain about the limits. There is no real bank at the other end, and no collect request reaches a UPI app.

So the sandbox tests your side of the relay. Use it most of all for the server messages. That page advises fulfilling the order on the server message, known as a webhook, not on the browser callback, and warns that webhooks can arrive more than once and out of order. Each of those is a test: send the success message twice and confirm one order, not two.

What a sandbox cannot show is anything that involves the phone: whether the right UPI app opens, whether your app survives the switch, how a slow bank or an empty account behaves, and whether the bank SMS, the UPI app and the order agree. For those, pay small real amounts, ₹1 to ₹10, on real phones, and refund each one.

Intent, QR and collect: test each way of paying you offer

Each way of paying fails differently.

Way of payingHow the customer paysWhat to check
IntentYour app opens a UPI app with the amount filled inThe right apps are offered, the name and amount are correct, the result comes back
QR codeThe customer scans a code shown on another screenThe code expires, one code takes one payment, the page updates without a refresh
Collect requestThe customer types a UPI ID and approves a request in their UPI appWhether your gateway still offers it, a mistyped UPI ID, an unanswered request

Collect needs a question before a test. NPCI's circular says collect is not permitted for person-to-person payments, and gateways have been moving merchants off it too: the Razorpay page above marks collect as deprecated from 28 February 2026, with exceptions that include iOS and mobile web. Ask your gateway which ways of paying your account supports on each platform, and test those.

For intent, the handover is a link. Google's guide to in-app UPI payments lists its fields: pa (the payee's UPI ID), pn (payee name), mc (merchant code), tr (transaction reference), tn (note), am (amount) and cu (currency). Ritu's payment would travel as something like this, plus the merchant code:

upi://pay?pa=freshbasket@examplebank&pn=FreshBasket&tr=FB48213A1&tn=Order%20FB48213&am=1249.00&cu=INR

Three checks follow from it.

  • Amount. The UPI app shows the cart total to the paisa. Try ₹1,249.00, ₹1,249.50 and ₹1, and try to edit the amount inside the UPI app. It should be locked.
  • Name. NPCI's circular requires the UPI app to show the amount and the beneficiary's name before the customer authorises the payment. It also says a merchant's name must be its verified brand name or the name in the bank's records, not one taken from a QR code or typed in by a user. Check that the name on the PIN screen is one your customers will recognise.
  • Reference. Each attempt carries its own reference, which you can find later in your admin panel.

Android and iPhone hand over differently

Android. A generic UPI link lets the system offer the apps that can handle it, and Google's guide notes that NPCI requires merchants to support that generic call in all cases. Many apps draw their own list of UPI apps as well, and that list is worth a deliberate test. For apps that target Android 11 or higher, Android's package visibility rules filter what an app can find out about other installed apps, so calls such as queryIntentActivities() return limited results unless the app's manifest declares what it needs in a <queries> element. A missing declaration shows up as a short or empty list of UPI apps on a newer phone, while a test phone on Android 10 looks fine.

Install Google Pay, PhonePe, Paytm and BHIM and confirm all four are offered. Uninstall one and confirm it disappears. Then try an app that is installed but not set up: the NPCI circular says a UPI app answers a merchant's intent call only when the user is registered on it and has set a UPI PIN.

When the UPI app closes, Android returns a result to your app. Treat it as a hint. Google's guide says that when the returned status is submitted or succeeded, the merchant must still check with its payment provider that the correct amount was paid, and it marks that step as fraud prevention.

iPhone. There is no chooser of the Android kind, so the app shows its own list and opens the chosen UPI app by that app's own link. Coming back is the weak point. Google's iOS page says iOS does not switch back to the merchant app after payment, and the customer has to return by hand. So test three returns: at once through the app switcher, after five minutes, and never. In the third case the order should still be placed from the server's answer, and the customer told by notification.

Test every end state, not only success

A payment can end in at least six ways.

End stateHow to reach it on a real phoneWhat the app must do
SuccessPay ₹1 to ₹10 from the funded accountOne order, a receipt, the same amount in all three records
Wrong UPI PINEnter a wrong PIN onceClear failure, cart kept, retry offered
Low balancePay from the nearly empty accountFailure with the reason, no order
CancelledPress Back on the PIN screenReturn to checkout, with no alarming "payment failed"
ExpiredOpen the UPI app and leave it for ten minutesThe app stops waiting and says so
PendingA sandbox pending response, or a delayed server message in stagingA "payment pending" screen, with no Pay button for the same order

Enter the wrong PIN once, not five times. NPCI's UPI FAQ says a bank may temporarily block UPI payments from an account after several wrong entries, and that this varies from bank to bank. The same page puts the normal ceiling at ₹1 lakh per transaction, with higher limits for some categories. If a basket in your app can cross the ceiling that applies to you, test what the customer is told when it does.

Most of these rows are negative cases, the kind described in positive and negative testing, and a sandbox-only team never sees them on a real phone.

The pending state: money debited, order not placed

Pending is the state that costs money, because the app does not know the answer and still has to say something. Two rules explain how long it can last.

  • NPCI's circular lets a payment provider ask for a payment's status only after 60 seconds, and at most three times, preferably within two hours.
  • The Reserve Bank's 2019 circular on turnaround time covers the worst case. When an account is debited for a merchant payment and the confirmation never reaches the merchant, the money must be auto-reversed within five days of the transaction day, with compensation of ₹100 a day beyond that, paid without the customer having to claim it.

So a careful app plans for an answer that takes minutes, and for money that can take days to come back. Here is Ritu's payment as it should have gone.

TimeEventWhat the app shows
21:12:05She taps Pay ₹1,249; attempt FB48213A1 is created"Complete the payment in your UPI app"
21:12:31PIN entered; the bank debits ₹1,249She is still in the UPI app
21:12:40She returns; no answer has reached the server"Checking your payment", with no Pay button
21:13:40Still no answer"Payment pending. Please do not pay again. We will confirm by notification"
21:17:02The success message arrivesOrder placed, receipt shown, notification sent

Five tests come out of that table.

  1. The timer. When the app's own wait runs out, the message says pending, not failed.
  2. The retry guard. While an attempt is pending, Pay for the same cart is blocked or warns clearly.
  3. Late success. Pending turns into success after five minutes: the order is placed once and the customer is told.
  4. Late failure. Pending turns into failure: the message says what happens to the money.
  5. Paid twice. If two payments do succeed for one order, the second is refunded and both appear in the order history.

Practical rule: when the app does not know, it says "pending", never "failed". A wrong "failed" is how one order gets paid for twice.

The same failure has a post of its own in travel: money debited, ticket not booked. The confirmation usually arrives as a push message, which fails in its own ways, covered in how to test push notifications.

App switching and weak networks: where budget phones break the flow

While the customer is in the UPI app, your app sits in the background. On a phone that is short of memory, Android can close it, and when the customer comes back the app starts afresh. That is the Bhopal bug, and a developer's flagship phone rarely shows it.

You can force it on any Android phone. Android's guide to developer options explains how to switch them on, by tapping Build number seven times, and describes two settings under Apps: "Don't keep activities", which destroys every activity as soon as the user leaves it, and "Background process limit". Turn the first one on, pay, and come back. The app should reopen on a "checking your payment" screen for that attempt, not on a cart.

Then run the interruptions a real evening provides.

  • A phone call arrives while the PIN screen is open.
  • The customer double-taps Pay. One attempt is created, not two.
  • The customer swipes your app away from recents while in the UPI app, pays, and reopens it from the home screen.

Networks fail at the worst moment too, which is the second after the PIN is submitted. The debit goes through at the bank, and the phone is cut off from the answer.

  • Switch on flight mode for 30 seconds right after entering the PIN, then switch it off.
  • Pay on one bar of signal in a basement or a lift lobby.

In each case the app should recover by itself when the connection returns, and show the true status without the customer tapping anything. The wider set of conditions is in the Jio and Airtel test.

Refunds and the three records

NPCI's FAQ says a UPI payment cannot be stopped once it has been initiated. Every cancellation after payment is therefore a refund, and refunds need their own cases.

  • Full refund. Cancel a paid order. The app shows the refund with an amount and a status, and the money returns to the account it came from.
  • Partial refund. Return one item worth ₹180 from the ₹1,249 order. The refund is ₹180, and the order shows ₹1,069 paid.

Then reconcile every attempt in three places.

RecordWhere to lookWhat must match
BankSMS and account statementAmount, time, one debit for one order
UPI appTransaction historyMerchant name, amount, status, UPI reference
Your systemOrder screen, admin panel, gateway dashboardOrder ID, attempt reference, amount, status, refunds

A worked example: one payment on five phones

The payment is the ₹1,249 grocery order, by intent. The sheet below is illustrative, but it is the shape a run should produce.

PhoneUPI app and networkScenarioResult
Redmi 13CPhonePe, Jio 4GPay and return at onceOrder placed in 4 s. Pass
Redmi 13CPhonePe, Jio 4GSame, with "Don't keep activities" onApp reopens on the cart, no status check. Fail
Realme Narzo 60Google Pay, Airtel 4GWrong PIN once, then the right PINOne debit, one order. Pass
Galaxy A15Paytm, Vi 4G, one barFlight mode for 30 s after the PIN"Pending", then order placed. Pass
Vivo Y28BHIM, Wi-FiDouble-tap on PayTwo attempts created. Fail
iPhone 13Google Pay, Airtel 5GPay, return after two minutesOrder shown on return. Pass

The second row, filed properly, looks like this.

Title: After a PhonePe payment the app reopens on the cart and offers Pay again; no order is created (Redmi 13C)

  • Build: 5.2.0 (318), Android
  • Device and network: Redmi 13C, Jio 4G, PhonePe
  • Starting state: Cart of ₹1,249, "Don't keep activities" on

Steps to reproduce:

  1. Tap Pay ₹1,249 and choose PhonePe.
  2. Enter the UPI PIN and wait for the success screen.
  3. Return to the grocery app.
  • Expected: The app shows the status of that attempt, then the order.
  • Actual: The cart, with Pay ₹1,249 active. The bank SMS shows the debit. No order in My orders.
  • Reproducibility: 3 of 3 with the setting on, 0 of 3 with it off.
  • Evidence: Screen recording, bank SMS, attempt reference.

The reproducibility line tells the developer that the app loses its place only when Android has closed it. Writing reports this way is covered in steps to reproduce a bug, and the full set of fields is in our bug report template.

How to test a UPI payment flow before every release

A UPI app has to be registered with the mobile number linked to a bank account, which an emulator does not have. The handover and everything after it need a real phone, for the reasons set out in emulator vs real device testing.

Before each release a short set is enough: one success by intent on an Android phone and an iPhone, one cancellation, one return with "Don't keep activities" on, one pending-to-success run in the sandbox and one refund. Run the full matrix when the gateway's SDK, the checkout screen or the order logic changes. Recurring payments have rules of their own, covered in how to test UPI AutoPay mandates.

Frequently asked questions

Can I test UPI payments without spending real money? Partly. A gateway's sandbox simulates outcomes, which is enough for your order logic and server messages. No real UPI app or bank is involved, so the handover, the return and the reconciliation need small real payments that you refund.

Which test UPI ID should I use? The one your gateway documents. Razorpay's test mode, for example, uses success@razorpay and failure@razorpay. Each gateway has its own.

Why does the app say "failed" when the money was debited? Usually because the app stopped waiting before the bank's answer arrived, or lost its place when the customer switched apps. The cure is a pending state and a status check from the server.

How long can a UPI payment stay pending? There is no single figure. NPCI's rules allow the first status check 60 seconds after the payment, and the Reserve Bank's circular gives up to five days for the auto-reversal of a debited but unconfirmed merchant payment. Design the app for minutes, and word the message for days.


A UPI payment is tested when real rupees have moved on the phones your customers carry, and the bank, the UPI app and your order screen tell the same story. 99tests runs your test cases on tester-owned Redmi, Realme, Galaxy, Vivo and iPhone handsets on Jio, Airtel and Vi, and a reviewer verifies every finding before it reaches you, with steps, expected and actual results, environment details and a screenshot or recording. Start from the free test case library, which has 950 cases across 25 flows, or read a sample report.