---
page_title: UPI Intent
product: SmartGateway TranPortal Integration
page_source: https://smartgateway.hdfc.bank.in/docs/docs/smartgateway-tranportal-integration/docs/tranportal-integration/upi-intent
openapi: https://smartgateway.hdfc.bank.in/docs/docs/api/swagger?document=https%3A%2F%2Fsmartgateway.hdfc.bank.in%2Fdocs%2Fdocs%2Fsmartgateway-tranportal-integration%2Fdocs%2Ftranportal-integration%2Fupi-intent
llms_txt: https://smartgateway.hdfc.bank.in/docs/docs/llms.txt
product_llms_txt: https://smartgateway.hdfc.bank.in/docs/docs/smartgateway-tranportal-integration/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, the merchant calls HDFC SmartGateway’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. 


### **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/docs/android/intents](https://developer.chrome.com/docs/android/intents)


### **How to create a dynamic QR on Web?** 



From the response parameters of the transaction API call for QR Code payment method, the SDK parameters are can be used to construct a URI and bind that URI to QR code.

* Generating UPI Pay String and binding it with QR code :There are several Js libraries that help in generating QR code and binding string with the QR code. Sample library : [https://www.npmjs.com/package/qrcode](https://www.npmjs.com/package/qrcode)
* Merchant needs to bind the Pay String using the following steps:1)Create QR code object2)Encode the UPI Pay String to bytes3)Make QR code


### **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 HDFC SmartGateway callback of payment status and give the response in the frontend to the client side. Merchant can also call the order status API of HDFC SmartGateway to check the Order Status of the transaction.

**Merchants can follow  similar steps for generating the QR codes for web.** ## Endpoints:
- Sandbox: https://smartgateway.hdfcuat.bank.in/txns

- Production: https://smartgateway.hdfc.bank.in/txns

## Request Type: 
POST

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from HDFC SmartGateway dashboard

Example:-Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: Base64 Encoded username, Mandatory
## Headers:

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

#### x-resellerid:
Reseller ID provided by bank
- Value: hdfc_reseller
- Tags: String, Required
## Sample Code Snippets:
### Sample Request:

#### Request Code Snippet:

```request
curl --location 'https://smartgateway.hdfc.bank.in/txns' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'x-merchantid: merchant_id' \
--data-urlencode 'order_id=TEST23' \
--data-urlencode 'merchant_id=merchant_id' \
--data-urlencode 'payment_method_type=UPI' \
--data-urlencode 'payment_method=UPI_PAY' \
--data-urlencode 'txn_type=UPI_PAY' \
--data-urlencode 'sdk_params=true' \
--data-urlencode 'redirect_after_payment=true' \
--data-urlencode 'format=json'

```

### Sample Response:

#### Response:
```json
{
    "payment": {
        "sdk_params": {
            "mode": "04",
            "tr": "testhdfc1-TPVTEST23-1",
            "merchant_vpa": "jphdfc03@hdfcbank",
            "customer_last_name": "",
            "tn": "",
            "mcc": "6012",
            "qrMedium": "06",
            "merchant_name": "TEST HDFC SECURITIES",
            "pgIntentUrl": "upi://pay?ver=01&mode=04&tr=testhdfc1-TPVTEST235-2&tn=&pn=TEST%20HDFC%20SECURITIES&pa=jphdfc03@hdfcbank&mc=6012&am=10.00&cu=INR&qrMedium=06",
            "currency": "INR",
            "ver": "01",
            "amount": "10.00",
            "tid": "mozpxhGZuNSEhxbKgim",
            "customer_first_name": ""
        },
        "authentication": {
            "method": "GET",
            "url": "https://smartgatewayuat.hdfcbank.com/v2/pay/start/testhdfc1/mozpxhGZuNSEhxbKgim?cardIssuerBankName%3DUPI_PAY%26cardType%3DUPI%26paymentMethod%3DUPI_PAY%26paymentMethodType%3DUPI"
        }
    },
    "status": "PENDING_VBV",
    "txn_uuid": "mozpxhGZuNSEhxbKgim",
    "offer_details": {
        "offers": []
    },
    "order_id": "TPVTEST23",
    "txn_id": "testhdfc1-TPVTEST23-1"
}

```

## Body Parameters:
### Parameters:

#### merchant_id:
- Description: The merchant id associated with HDFC SmartGateway
- 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: Must be UPI_PAY
- Tags: string, Mandatory

#### txn_type:
- Description: Must be UPI_PAY
- 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://smartgateway.hdfc.bank.in/docs/docs/smartgateway-tranportal-integration/docs/tranportal-integration/verify-vpa)
- [Tokenize](https://smartgateway.hdfc.bank.in/docs/docs/smartgateway-tranportal-integration/docs/tranportal-integration/tokenize)
