Skip to main content
Available in🇮🇳 India
You can collect payments using the UPI Intent Flow. In this flow, when customer selects UPI as the payment method, the list of UPI PSP apps is displayed. When the customer selects their preferred app, it opens automatically. They can complete the payment on the UPI PSP app.

Best Practices

Following are a few of the best practices to be followed to accept online payments using UPI Intent Flow:
  1. Do not change Intent URL
    Do not make changes to the intent URL shared by Razorpay as part of the API response. Making changes to the intent URL can lead to payment failure.
  2. Host UPI apps
    It is recommended to host the UPI apps on your page/app instead of just hosting the Intent URI where the native Android drawer shows the apps. This improves conversion.
  3. Rank UPI Apps by Success Rate
    Show the UPI PSP apps in the order of their success rate.
  4. Mobile site
    If you have higher traffic via mobile site, make sure you provide the option of UPI intent payment to your users using our m-site integration. This will help you achieve better success rates.
  5. Gpay SDK
    If your UPI transaction volumes are high, you can also explore integrating Gpay SDK. This provides a better user experience and about a 3-5% improvement in success rate.

Prerequisites

UPI Intent Flow

Following is the process for accepting payments using the UPI Intent Flow: Customers need not enter VPA or phone number as these details are pre-filled and submitted along with the other payment details. While making the payment, customers select the UPI PSP app on your app. The UPI PSP app is launched automatically on their mobile devices, where the payment is completed.
  1. The customer selects UPI as the payment method.
  2. The customer chooses their preferred UPI PSP app from the list.
  3. The UPI PSP app opens automatically and the customer completes the payment.

Integration Steps

  1. Create an order.
  2. Initiate Payment using the intent URL.
  3. Store Fields in Your Server.
  4. Verify the Signature.

Step 1: Create an Order

POST /orders Given below is the sample code when method is upi.
Watch Out!If you are a TPV business using the Consolidated Payment API, you must pass method=upi in both of the following:
  1. The Create Order request (/v1/orders) shown in the sample above.
  2. The Initiate Payment request (/v1/payments/create/upi) covered in Step 2.
Omitting method=upi from the payment initiation request causes an invalid bank code error, particularly for long-tail banks. This applies even if method is correctly set at the order level.
If the user selects the payment method within the Razorpay UI, there is no need to include the method field. Below is a sample code for reference.

Request Parameters

amount mandatory : integer The transaction amount expressed in paise (currency supported is INR). For example, for an actual amount of ₹1, the value of this field should be 100. currency mandatory : string The currency in which the transaction should be made. You can create orders in INR only. receipt optional : string Receipt number that corresponds to this order, set for your internal reference. Maximum length is 40 characters. notes optional : json object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”. method mandatory : string The payment method used to make the payment. If this parameter is not passed, investors will be able to make payments using both netbanking and UPI payment methods. Possible values:
  • netbanking: Investors can make payments only using netbanking.
  • card: Investors can make payments using debit card.
  • upi: Investors can make payments only using UPI.
bank_account mandatory : object Details of the bank account that the investor has provided at the time of registration. account_number mandatory : string The bank account number from which the investor should make the payment. For example, 765432123456789 Payments will not be processed for an incorrect account number. name mandatory : string The name linked to the bank account. For example, Gaurav Kumar. ifsc mandatory : string The bank IFSC. For example, HDFC0000053.

Step 2: Initiate a Payment

POST /payments/create/upi
Do Not Make Changes to Link Received in ResponseDo not make changes to the link you receive in the response. This is the Razorpay Intent URL. Making changes to this URL can lead to payment failure or other unexpected errors with the payment.

Request Parameters

Following are the request parameters for the API: amount mandatory : integer The amount associated with the payment in the smallest unit of the supported currency. For example, 2000 means ₹20. currency mandatory : string ISO code of the currency associated with the payment amount. In this case, it is INR. order_id mandatory : string Unique identifier of the order obtained from the response of the previous step. method mandatory : string The payment method used to make the payment. Possible values:
  • netbanking
  • upi
method is Required at Both Order and Payment Level for TPVFor TPV businesses, method=upi must be explicitly passed here in the payment initiation request, in addition to the Create Order request in Step 1. This is mandatory for correct bank code resolution across all banks, including long-tail banks.
notes optional : json object Key-value pair used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”. description optional : string Descriptive text of the payment. contact mandatory : string Phone number of the customer. email mandatory : string Email address of the customer. callback_url optional : string URL where Razorpay will submit the final payment status. ip mandatory : string The client’s browser IP address. For example, 117.217.74.98 referer mandatory : string Value of the referer header passed by the client’s browser. For example, https://example.com/. user_agent mandatory : string Value of the user_agent header passed by client’s browser. For example, Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 upi mandatory : Details of the UPI payment flow : string Type of the UPI method. In this case, it is intent. You will get the UPI Intent URI as part of the payment response. To pass the payment data to the respective UPI app and to initiate the payment, use the following code:
Pass data to UPI app

Step 3: Store Fields in Your Server

A successful payment returns the following fields to the Checkout form.
  • You need to store these fields in your server.
  • You can confirm the authenticity of these details by verifying the signature in the next step.

razorpay_payment_id : string Unique identifier for the payment returned by Checkout only for successful payments.razorpay_order_id : string Unique identifier for the order returned by Checkout.razorpay_signature : string Signature returned by the Checkout. This is used to verify the payment.

Step 4: Verify the Payment Signature

This is a mandatory step to confirm the authenticity of the details returned to the Checkout form for successful payments.
  1. Create a signature in your server using the following attributes:
    • order_id: Retrieve the order_id from your server. Do not use the razorpay_order_id returned by Checkout.
    • razorpay_payment_id: Returned by Checkout.
    • key_secret: Available in your server. The key_secret that was generated from the Dashboard.
  2. Use the SHA256 algorithm, the razorpay_payment_id and the order_id to construct a HMAC hex digest as shown below:
HMAC Hex Digest
  1. If the signature you generate on your server matches the razorpay_signature returned to you by the Checkout form, the payment received is from an authentic source.
Given below is the sample code for payment signature verification:
After you have completed the integration, you can set up webhooks, make test payments, replace the test key with the live key and integrate with other APIs.

Payment Capture Settings

After payment is authorized, you need to capture it to settle the amount to your bank account as per the settlement schedule. Payments that are not captured are auto-refunded after a fixed time.
Watch Out
  • You should deliver the products or services to your customers only after the payment is captured. Razorpay automatically refunds all the uncaptured payments.
  • You can track the payment status using our Fetch a Payment API or webhooks.