---
page_source: https://juspay.io/in/docs/ec-api/docs/base-integration/upi-intent-payment
page_title: UPI Intent Payment
---

## API Version: default


# UPI Intent Payment



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**
> 1. 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.
> 2. `tid` is not a mandatory paramater for constructing the Intent URI. If `tid` is not present in th sdk_params object, you may ignore it.

## Endpoints:
- Sandbox: https://payments.sandbox.juspay.in/txns

- Production: https://payments.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:

#### New UPI Intent Request Code Snippet:

```new upi intent request
{"success":false,"message":"No Data found for the given path"}
```

#### Old UPI Intent Request Code Snippet:

```old 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" \
-d "txn_type=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/eulgxNxxxxcnKwoqe2",
      "method": "GET"
    }
  },
  "order_id": "9727125664Q20200107180320"
}
```

## Body Parameters:
### Parameters:

#### order_id:
- Description: `order_id` pertaining to the order for which the payment is started.
- Tags: string, Mandatory

#### merchant_id:
- Description: ID of the merchant_account that you hold with us.
- 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

#### redirect_after_payment:
- Description: This is a boolean variable and accepts true/false. We recommend that you set this to true. 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, Mandatory

#### 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, Mandatory

#### sdk_params:
- Description: Should be passed as true
- Tags: string

#### upi_app:
- Description: The package name of the UPI app used.
- Tags: string

#### offers:
- Description: The key offers should be passed only when juspay offers are being used. The value for this key can set as the offerID which is received from /v1/offers/list api
- Tags: array of Strings
## 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.tr**:
    - Tags: string
  - **Sdk_params.tid**:
    - Tags: string
  - **Sdk_params.merchant_vpa**:
    - Tags: String
  - **Sdk_params.merchant_name**:
    - Tags: String
  - **Sdk_params.mcc**:
    - Tags: String
  - **Sdk_params.amount**:
    - Tags: String
  - **Authentication.url**:
    - Tags: String
  - **Authentication.method**:
    - Tags: String
- Tags: object

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

#### status:
- Description: error
- Tags: string

#### error_message:
- Description: Order timed out
- Tags: string

#### error_code:
- Description: invalid_request
- Tags: string
