Skip to main content
UPI Intent opens your customer’s UPI app directly, with the payment amount and your business details already filled in. Your customer doesn’t type a UPI ID or scan a QR code. Use UPI Intent whenever your customer checks out on a mobile device, either on your mobile website or in your app.

How it works

UPI Intent uses a deep link that starts with upi://pay. On Android, when your customer taps Pay, your checkout passes this link to the operating system, which lists the installed apps that can handle it. On iOS, there is no system app picker for UPI links. Each UPI app uses its own proprietary URL scheme, such as phonepe:// or paytmmp://, so your checkout must detect the installed apps and open the one your customer selects. The Cashfree iOS SDK does this for you. The selected app opens with the amount and your business name filled in, and your customer approves the payment with their UPI PIN. The app then returns the customer to your checkout, and Cashfree sends you the final payment status.
Never treat the customer’s return to your app or website as proof of payment. Always confirm the final status through the payment webhook or the Get Payments for an Order API before you fulfil the order.

Integration options

Choose an integration option that matches your checkout:

Use the Cashfree SDKs or Hosted Checkout

With this option, you don’t write UPI-specific code. On Android, the operating system shows the UPI app picker as soon as the link opens. On iOS, the Cashfree iOS SDK detects the installed UPI apps and opens the one your customer selects. This option works with the following Cashfree SDKs: It also works with Hosted Checkout when it opens in a mobile browser or through a full-page redirect.
On Android, the operating system lists the installed UPI apps that can handle the upi://pay link. On iOS, some in-app browsers, such as those in social media apps, may not open UPI app links and show no error. If much of your iOS traffic comes from in-app browsers, also offer dynamic QR codes or UPI Collect, which iOS still supports.
A WebView doesn’t hand links to other apps the way a mobile browser does. If you load Hosted Checkout inside a WebView, the UPI option appears but does nothing when tapped. To fix this, your app must intercept the UPI link and open the matching app. The following table summarises what your app must do on each platform: For the code samples, use the following guides: If you build your own checkout, request the UPI link from Cashfree and open it yourself. Before you begin, make sure that you have the following:
  • API keys from the Merchant Dashboard.
  • Server-to-server (S2S) payments enabled for your account. To enable it, fill out the Support Form.
Complete the following steps:
  1. From your server, create an order with the Create Order API. The response contains a payment_session_id. It doesn’t contain a UPI link.
  2. Call the Order Pay API with the payment_session_id, and set payment_method.upi.channel to link.
  3. On the customer’s device, open the upi://pay link from data.payload.default, or an app-specific link, such as data.payload.phonepe.
  4. Wait for the payment webhook, and then confirm the final status before you fulfil the order.
The following diagram shows the API calls in a custom integration:

Request

Send the request to POST /pg/orders/sessions. Use https://sandbox.cashfree.com/pg for testing and https://api.cashfree.com/pg for production. This API authenticates with the payment_session_id, so it doesn’t need your client ID and secret. Pass the x-api-version header with the API version you use. The following table describes the request parameters for a UPI link:

Response

The following table describes the response fields that you use for UPI Intent: If the request fails, the API returns an error object with message, code, and type. For all error codes, see the Order Pay API reference. The following example requests a UPI link:
This example is untested, illustrative, and abbreviated. The keys inside payload and the link formats can vary by account and API version. Check the Order Pay API reference for the current response schema.
If your own checkout runs inside a WebView, also follow the steps in Handle UPI links in a WebView.

Test UPI Intent

Use the Cashfree UPI simulator app on an Android device or emulator to approve or decline UPI Intent payments in the sandbox environment.

Troubleshooting

This usually happens when your checkout runs inside a WebView that doesn’t handle UPI links. Add the handling described in UPI Intent in WebView.
This usually happens when the customer is in an in-app browser that blocks UPI links. Offer a dynamic QR code or UPI Collect as an alternative for iOS traffic from in-app browsers.