---
page_title: UPI Intent
product: API Reference
page_source: https://juspay.io/in/docs/api-reference/docs/express-checkout/upi-intent
openapi: https://juspay.io/in/docs/api/swagger?document=https%3A%2F%2Fjuspay.io%2Fin%2Fdocs%2Fapi-reference%2Fdocs%2Fexpress-checkout%2Fupi-intent
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/api-reference/llms.txt
---

## API Version: default


# UPI Intent



The API can be used for providing intent support on app, mobile web or web (Dynamic QR). When the Customer chooses the UPI app on the payment page and clicks the Pay button, Merchant calls Juspay’s transaction API with parameters depending on different payment methods chosen by the Customer. The API response will have the parameters required for constructing the intent URI. Merchant can then construct the URI and invoke the APP using chrome intent feature. 

> **Note**
> Please use the relevant parameters received from the **Payment Method API in UPI** for **payment_method_type**  and **payment_method**  fields.




### **Construction of UPI Pay String code through the string mentioned** 



The sdk_params obtained in the response of the UPI transaction call should be used for constructing the Intent URI.

**Sample URI:** upi://pay?tr=202101345671229366&tid=121313202101345671229366&pa=juspay@axisbank&mc=1234&pn= Merchant%20Inc&am=1.00&cu=INR&tn=Pay%20for%20merchant

**Format:** upi://pay?tr=...(enter the tr).......&tid=...(enter the tid).......&pa=.....(enter merchant_vpa)...&mc=....(enter the mcc)...&pn=....(enterthe Merchant name)...&am=.....(enter the amount).....&cu=INR&tn=....(description for the transaction)..

> **Note**
> In the URI spaces are replaced by "%20". The URI is encoded. Kindly generate the intent URI dynamically ie, based on the params received in the sdk_params response. Do not hardcode any keys or values as it can differ with different PG’s.




### **How to create an intent from mWeb browser?** 



Once the URI is constructed, it should be embedded into the page. The mobile browser then checks for the UPI apps on the phone and displays them. Customer clicks on the app and completes the payment.

Sample Reference for chrome Intent is given below:[https://developer.chrome.com/multidevice/android/intents](https://developer.chrome.com/multidevice/android/intents)


### **How to handle payment status once the payment is completed?** 



Unlike in Web collect, where the success response is redirected to the merchant's return url as well as through server callback, in intent, only a callback response is posted on Merchant’s server. This is because UPI intent is an App to app switch push payment. While payment is being done via the UPI app, Merchant has to show a waiting/loader page on the background. Merchants should continuously poll their own server to check for Juspay callback of payment status and give the response in the frontend to the client side. Merchant can also call the order status API of Juspay to check the Order Status of the transaction.## Endpoints:
- Sandbox: https://sandbox.juspay.in/txns

- Production: https://api.juspay.in/txns

## Request Type: 
POST

## Headers:

#### Content-Type:
application/x-www-form-urlencoded
- Tags: String, Mandatory

#### x-routing-id:
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.

> **Warning**
> This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.


- Value: customer_1122
- Tags: String, Required
## Sample Code Snippets:
### Sample Request:

#### Old UPI Intent Request Code Snippet:

```old upi intent request
curl -X POST https://api.juspay.in/txns \
-H 'x-routing-id: customer_1122'\
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'merchant_id=juspay&order_id=9727125664Q20200107180320&payment_method_type=
UPI&payment_method=UPI&txn_type=UPI_PAY&redirect_after_payment=true& format=json&sdk_params=true'

```

#### New UPI Intent Request Code Snippet:

```new upi intent request
curl -X POST https://api.juspay.in/txns \
-H'x-routing-id: customer_1122'\
-d "order_id=9727125664Q20200107180320" \
-d "merchant_id=juspay" \
-d "payment_method_type=UPI" \
-d "payment_method=UPI_PAY" \
-d "redirect_after_payment=true" \
-d "format=json"\
-d "sdk_params=true"\
-d "upi_app=com.phonepe.app"

```

### Sample Response:

#### Response:
```json
{
    "txn_uuid": "eulgxNx4mgcnKwoqe2",
    "txn_id": "9727125664Q20200107180320",
    "status": "PENDING_VBV",
    "payment": {
      "sdk_params": {
        "tr": "202101345671229366",
        "tid": "121313202101345671229366",
        "merchant_vpa": "juspay@axisbank",
        "merchant_name": "juspay",
        "mcc": "1234",
        "amount": "1"
      },
      "authentication": {
        "url": "https://api.juspay.in/v2/pay/start/juspay/eulgxNx4mgcxxxxqe2",
        "method": "GET"
      }
    },
    "order_id": "9727125664Q20200107180320"
  }
```

## Body Parameters:
### Parameters:

#### merchant_id:
- Description: The merchant id associated with Juspay
- Tags: string, Mandatory

#### order_id:
- Description: The order Id against which the payment has to be initiated
- Tags: string, Mandatory

#### payment_method_type:
- Description: Must be UPI
- Tags: string, Mandatory

#### payment_method:
- Description: Please use the relevant values received in **payment_method field from the** **Payment Method API** .
- Tags: string, Mandatory

#### txn_type:
- Description: Must be `UPI_PAY`for Old UPI Intent Request. This field is obsolete for New UPI Intent Request
- Tags: string, Mandatory

#### sdk_params:
- Description: Should be true for receiving the intent params
- Tags: boolean, Mandatory

#### redirect_after_payment:
- Description: This is a boolean variable and accepts true/false. We recommend that you set this to true and use the redirection flow. If set to true, then the user is redirected to the return_url configured for the order. If set to false, then the user will be stopped at the response page from the gateway. Your client should be able to read the page/title to infer that the user has completed the transaction.
- Tags: boolean

#### format:
- Description: If it is set to json, then the response will be HTTP 200 with a JSON formatted text. Otherwise, the response is HTTP 302 with the Location attribute having the destination URL.
- Tags: string
## API Responses:
### 200:

#### txn_uuid:
- Description: eulgxNx4mgcnKwoqe2
- Tags: string

#### txn_id:
- Description: 9727125664Q20200107180320
- Tags: string

#### status:
- Description: PENDING_VBV
- Tags: string

#### payment:
- Value:
  - **Sdk_params**:
    - Value:
      - **Tr**:
        - Tags: String
      - **Tid**:
        - Tags: String
      - **Merchant_vpa**:
        - Tags: String
      - **Merchant_name**:
        - Tags: String
      - **Mcc**:
        - Tags: String
      - **Amount**:
        - Tags: String
    - Tags: object
  - **Authentication.url**:
    - Tags: String
  - **Authentication.method**:
    - Tags: String
- Tags: object

#### order_id:
- Description: 9727125664Q20200107180320
- Tags: string


---

## See Also

- [Verify VPA](https://juspay.io/in/docs/api-reference/docs/express-checkout/verify-vpa)
- [UPI Package Names](https://juspay.io/in/docs/api-reference/docs/express-checkout/upi-package-names)
