Skip to main content
Available in🇮🇳 India
Use test mode to check your UPI Autopay integration before you go live. Test mode simulates the responses from NPCI and the customer’s bank, so you can register mandates, run auto-debits and handle failures without moving real money or using a UPI app.

Test Mode Coverage

Test mode covers mandate registration, auto-debits and token management. A few live mode behaviours depend on real time windows or on actions the customer takes in their UPI app, and test mode does not simulate these. Read this section first so you know which parts of your integration you need to verify in live mode.
Available in Live Mode OnlySome live mode behaviours are not available in test mode:
  • Razorpay does not automatically retry failed auto-debits in test mode, so a failed debit stays failed.
  • Test mode does not reproduce the 24-hour gap that NPCI requires between the pre-debit notification and the debit, or the debit execution windows, so debits are not held in the created state.
  • Actions that a customer takes in their UPI app, such as pausing, resuming or revoking a mandate, or approving a change to a mandate, are not generated. You can still cancel a token yourself through the API.
  • Pre-debit notifications always succeed.
  • Test mode does not provide shared test tokens. Register a mandate to create a token for your account.
Verify these behaviours in live mode before you rely on them.
The following can be tested in test mode:

Before You Begin

  • Generate your test mode API keys from the Dashboard. Keys that start with rzp_test_ send all requests to test mode. You do not need to enable any separate flag.
  • Use the same APIs and request formats you use in live mode. Only the API keys change.
  • Pass every amount in paise, as you do in live mode. For example, send 201 for ₹2.01 and 100 for ₹1.
  • Configure a webhook URL in your test mode Dashboard to receive test events.
Specific amounts are reserved to trigger failures. Any amount listed in Simulate Failures returns that failure. Use 100 (₹1) for a successful payment.

Test Mandate Registration

Registration creates the mandate and the token that you use for later debits. In test mode, the simulator approves or declines the registration on its own, so you do not need to open a UPI app or enter a UPI PIN.

Register a Mandate Successfully

  1. Create a customer, or use an existing customer ID.
  2. Create an order with method set to upi and the token details: max_amount, expire_at and frequency. Set amount to 100.
  3. Create the registration payment with recurring set to 1 using the UPI intent flow.
  4. Check that the payment moves to captured and that a token is created in the confirmed state. Save the token ID for auto-debits.
The following is a sample request to create the registration order in test mode. It is the same request you send in live mode.
Curl

How the Intent Flow Behaves in Test Mode

The response contains an intent link, as it does in live mode. You do not need to open it. The simulator completes the registration and sends the callback and webhooks. To test a failed registration, use one of the amounts in Registration Failures.

Test Auto-Debits

After a mandate is registered, you can charge the customer using the saved token. Before every debit, the customer must receive a pre-debit notification. Razorpay supports two ways of handling this.

Coupled and Decoupled Flows

Both flows are available in test mode. Use the flow your account is configured for in live mode. Know more about the notification object in the Create an Order to Charge the Customer API.

Run a Successful Debit

  1. Create an order for the debit amount. Use 100, or any amount below the mandate’s max_amount that is not reserved for a failure.
  2. In the decoupled flow, pass the notification object with the token_id in this order to send the pre-debit notification.
  3. Create the recurring payment with the token ID and recurring set to 1.
  4. Check that the payment moves to captured and that you receive the payment.captured and order.paid webhooks.

Debit Rejections

These rejections come from the same checks that run in live mode.

Debit Failures

To test a failed debit, use one of the amounts in Auto-Debit Failures. Make sure the mandate’s max_amount is higher than the amount you choose.

Simulate Failures

Set the payment amount to one of the amounts below to trigger a failure. The same amounts trigger failures for one-time UPI payments in test mode. The error details returned for an amount depend on whether the payment is a mandate registration or an auto-debit, so each has its own table. Amounts are in paise. For example, 201 is ₹2.01. For auto-debits, make sure the mandate’s max_amount is higher than the amount you choose.

Registration Failures

Use these amounts for the registration order and payment. The payment moves to failed and no token is created.

Auto-Debit Failures

Use these amounts for the debit order and the recurring payment. The payment moves to failed and the token stays active.

Test Token Management

Tokens created in test mode behave the same way as live tokens for the actions below.

Cancel a Token

You can cancel a token in test mode when its recurring_details.status is confirmed.
  1. Send a PUT request to /v1/customers/:customer_id/tokens/:token_id/cancel. The request does not need a body.
  2. Check that the API returns HTTP 200 with the status cancellation_initiated.
  3. Fetch the token. The cancellation is not instant. Within about 45 seconds, recurring_details.status changes to cancelled.
Curl
Response
Pausing and resuming a mandate are customer actions in live mode and are not available in test mode.

Webhooks in Test Mode

Test mode sends the same webhooks as live mode, to the URL in your test mode Dashboard.
Handy TipsA webhook can be delivered more than once. Use the event ID to process each event only once. This applies in live mode as well.

Move to Live Mode

Before you switch to live keys, check the following:
  • Registration succeeds through every flow you offer, and your system stores the token ID.
  • Your system handles each failure scenario you expect, including failed registrations and failed debits.
  • Your debit amount checks match the mandate’s max_amount and expire_at.
  • Your webhook handler processes each event once, even when it is delivered more than once.
  • You have planned for the behaviours listed under Available in Live Mode Only, in particular the 24-hour gap before a debit, the created state, automatic retries and customer actions such as pause and revoke.
Last modified on November 27, 2026