> ## Documentation Index
> Fetch the complete documentation index at: https://www.cashfree.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Accept Payments with UPI Intent

> Use UPI Intent to open your customer's UPI app directly from mobile checkout through the Cashfree SDKs, a WebView, or the Order Pay API.

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.

<video autoPlay muted loop playsInline src="https://mintcdn.com/cashfreepayments-d00050e9/9Qy97XLzTQmWw4tu/static/payments/upi/upi-intent-flow.mp4?fit=max&auto=format&n=9Qy97XLzTQmWw4tu&q=85&s=7dcc66611578c9dc27cdf3da7c506a7c" type="video/mp4" />

## 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.

> [!WARNING]
>
> Never treat the customer's return to your app or website as proof of payment. Always confirm the final status through the [payment webhook](https://www.cashfree.com/docs/api-reference/payments/latest/payments/webhooks.md) or the [Get Payments for an Order API](https://www.cashfree.com/docs/api-reference/payments/latest/payments/get-payments-for-an-order.md) before you fulfil the order.

## Integration options

Choose an integration option that matches your checkout:

| Your checkout | Integration option |
| :- | :- |
| Cashfree mobile SDK, or Hosted Checkout opened in a mobile browser | [Use the Cashfree SDKs or Hosted Checkout](#use-the-cashfree-sdks-or-hosted-checkout) |
| Hosted Checkout loaded inside a WebView in your app | [Handle UPI links in a WebView](#handle-upi-links-in-a-webview) |
| Your own checkout interface that calls Cashfree APIs | [Get the UPI link from the Order Pay API](#get-the-upi-link-from-the-order-pay-api) |

### 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:

* [Android SDK](https://www.cashfree.com/docs/payments/online/mobile/android.md)
* [iOS SDK](https://www.cashfree.com/docs/payments/online/mobile/ios.md)
* [React Native SDK](https://www.cashfree.com/docs/payments/online/mobile/react-native.md)
* [Flutter SDK](https://www.cashfree.com/docs/payments/online/mobile/flutter.md)
* [Cordova SDK](https://www.cashfree.com/docs/payments/online/mobile/cordova.md)

It also works with [Hosted Checkout](https://www.cashfree.com/docs/payments/online/web/redirect.md) when it opens in a mobile browser or through a full-page redirect.

> [!NOTE]
>
> 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](https://www.cashfree.com/docs/payments/manage/payment-methods/upi-qr-codes.md#dynamic-qr-codes) or [UPI Collect](https://www.cashfree.com/docs/payments/manage/payment-methods/upi-collect.md), which iOS still supports.

### Handle UPI links in a WebView

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:

| Platform | What your app must do |
| :- | :- |
| Android | Override `shouldOverrideUrlLoading` in your `WebViewClient`, match UPI schemes such as `upi://pay`, `tez://`, `phonepe://`, and `paytmmp://`, and open them with an `ACTION_VIEW` intent. On Android 11 and later, also declare the UPI apps your app queries in the `<queries>` element of `AndroidManifest.xml`. |
| iOS | Declare each UPI app scheme under `LSApplicationQueriesSchemes` in `Info.plist`, check it with `canOpenURL`, and open it with `UIApplication.shared.open`. |

For the code samples, use the following guides:

* [UPI Intent in WebView](https://www.cashfree.com/docs/payments/online/mobile/misc/upi_intent_support_js_sdk.md) explains the changes for Android and iOS apps.
* [Custom Checkout for Android](https://www.cashfree.com/docs/payments/online/web/custom-checkout-android) shows how to intercept UPI app schemes in an Android WebView.
* [Custom Checkout for iOS](https://www.cashfree.com/docs/payments/online/web/custom-checkout-ios.md) shows how to declare and open UPI app schemes in a `WKWebView`.

### Get the UPI link from the Order Pay API

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](https://merchant.cashfree.com/merchants/landing?env=prod\&raise_issue=1).

Complete the following steps:

1. From your server, create an order with the [Create Order API](https://www.cashfree.com/docs/api-reference/payments/latest/orders/create-order.md). The response contains a `payment_session_id`. It doesn't contain a UPI link.
2. Call the [Order Pay API](https://www.cashfree.com/docs/api-reference/payments/latest/payments/order-pay.md) 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.

> [accordion] Sequence diagram for developers
>
> The following diagram shows the API calls in a custom integration:
>
> ```mermaid theme={"dark"}
> sequenceDiagram
>     autonumber
>     actor Customer
>     participant Checkout as Your checkout
>     participant Server as Your server
>     participant Cashfree
>     participant App as Customer's UPI app
>     Customer->>Checkout: Selects UPI and taps Pay
>     Checkout->>Server: Requests payment
>     Server->>Cashfree: Create Order API
>     Cashfree-->>Server: payment_session_id
>     Server->>Cashfree: Order Pay API (channel: link)
>     Cashfree-->>Server: UPI links in data.payload
>     Server-->>Checkout: UPI link
>     Checkout->>App: Opens the upi://pay link
>     Customer->>App: Approves with UPI PIN
>     App-->>Checkout: Returns the customer
>     Cashfree-->>Server: Payment webhook
> ```

#### 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:

| Parameter | Type | Required | Description |
| :- | :- | :- | :- |
| `payment_session_id` | string | Yes | The session ID returned by the Create Order API. |
| `payment_method.upi.channel` | string | Yes | Set to `link` to receive UPI Intent links. |
| `transaction_expiry_time` | string (ISO 8601) | No | The latest time by which the payment attempt must reach a final state. After this time, the payment can't be completed. Cashfree checks the payment status with the bank, and if the bank returns no result, Cashfree marks the payment `USER_DROPPED`. Timestamps are stored in IST, for example `2021-07-02T10:20:12+05:30`. A UTC value appears as `2021-07-02T10:20:12Z`. |

#### Response

The following table describes the response fields that you use for UPI Intent:

| Field | Type | Description |
| :- | :- | :- |
| `cf_payment_id` | string | Cashfree's identifier for the payment attempt. |
| `action` | string | Returns `custom`, which means your checkout must open the link itself. |
| `channel` | string | Returns `link`. |
| `data.payload` | object | UPI links for the payment. The `default` key holds the `upi://pay` link, and app-specific keys, such as `gpay` and `phonepe`, hold links that open one app. The `web` key holds the HTTPS URL of a Cashfree-hosted page, not a UPI app link. The payload contains the `default`, `gpay`, `phonepe`, `paytm`, `bhim`, and `web` keys. |

If the request fails, the API returns an error object with `message`, `code`, and `type`. For all error codes, see the [Order Pay API](https://www.cashfree.com/docs/api-reference/payments/latest/payments/order-pay.md) reference.

The following example requests a UPI link:

```bash Request theme={"dark"}
curl --request POST \
  --url https://sandbox.cashfree.com/pg/orders/sessions \
  --header 'Content-Type: application/json' \
  --header 'x-api-version: 2026-01-01' \
  --data '{
    "payment_session_id": "<PAYMENT_SESSION_ID>",
    "payment_method": {
      "upi": {
        "channel": "link"
      }
    }
  }'
```

```json Success response theme={"dark"}
{
  "action": "custom",
  "cf_payment_id": "<CF_PAYMENT_ID>",
  "channel": "link",
  "payment_method": "upi",
  "payment_amount": 100,
  "data": {
    "url": null,
    "payload": {
      "default": "upi://pay?pa=<MERCHANT_VPA>&pn=<MERCHANT_NAME>&tr=<REFERENCE>&am=100.00&cu=INR&mode=04&purpose=00&mc=<MCC>&tn=<TRANSACTION_NOTE>",
      "gpay": "tez://upi/pay?pa=<MERCHANT_VPA>&...",
      "phonepe": "phonepe://pay?pa=<MERCHANT_VPA>&...",
      "paytm": "paytmmp://pay?pa=<MERCHANT_VPA>&...",
      "bhim": "bhim://upi://pay?pa=<MERCHANT_VPA>&...",
      "web": "https://api.cashfree.com/pg/view/upi/<WEB_PAGE_ID>"
    },
    "content_type": null,
    "method": null
  }
}
```

```json Error response theme={"dark"}
{
  "message": "<ERROR_MESSAGE>",
  "code": "request_failed",
  "type": "invalid_request_error"
}
```

> [!WARNING]
>
> 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](https://www.cashfree.com/docs/api-reference/payments/latest/payments/order-pay.md) 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](#handle-upi-links-in-a-webview).

## Test UPI Intent

Use the [Cashfree UPI simulator app](https://www.cashfree.com/docs/payments/online/mobile/misc/cashfree_upi_simulator_apk.md) on an Android device or emulator to approve or decline UPI Intent payments in the sandbox environment.

## Troubleshooting

> [accordion] Customers see a QR code instead of UPI app icons on mobile
>
> 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](https://www.cashfree.com/docs/payments/online/mobile/misc/upi_intent_support_js_sdk.md).

> [accordion] The UPI option does nothing when an iOS customer taps it
>
> 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.

Related topics

<ul>
  <li>[Order Pay API](https://www.cashfree.com/docs/api-reference/payments/latest/payments/order-pay.md)</li>
  <li>[Create Order API](https://www.cashfree.com/docs/api-reference/payments/latest/orders/create-order.md)</li>
  <li>[UPI app reordering](https://www.cashfree.com/docs/payments/features/upi-app-reordering.md)</li>
</ul>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.