UPI INTENT
Request Details
| Parameter Name | Data Type | Mandatory | Description |
|---|---|---|---|
merchantOrderId | String | Yes | Unique order ID generated by merchant |
amount | long | Yes | Amount of order in Paisa |
contraints | List<InstrumentConstraint> | No | Different type of constraints that must be applied to the payment |
deviceOS | String | No | Operating system of the device. Allowed values are: 1. IOS 2. ANDROID |
merchantCallbackScheme | String | No | Required only in case targetApp = PHONEPE and deviceOS = IOS |
targetApp | String | No | The target app identifier for the UPI Intent flow. For IOS: PHONEPE, GPAY, PAYTM. For Android: com.phonepe.app, net.one97.paytm |
Example
import {CustomCheckoutClient, Env}
from 'pg-sdk-node';
import { PgPaymentRequest, PgPaymentResponse }
from 'pg-sdk-node';
import { v4
as uuid }
from 'uuid';
const clientId:
string = "<clientId>";
const clientSecret:
string = "<clientSecret>";
const clientVersion:
string = 1; //insert your client version here
const env:Env = Env.SANDBOX; //change to Env.PRODUCTION when you go live
const client = CustomCheckoutClient.
getInstance(clientId, clientSecret, clientVersion, env);
const merchantOrderId =
uuid();
const amount = 100;
const deviceOS = 'IOS';
const targetApp = 'PHONEPE';
const request = PgPaymentRequest.
UpiIntentPayRequestBuilder()
.
merchantOrderId(merchantOrderId)
.
amount(amount)
.
targetApp(targetApp)
.
deviceOS(deviceOS)
.
build();
cliet.
pay(request).
then((response) => {
const intentUrl = response.intentUrl;
});Extract the intentUrl from the response received.
Response Details
| Property | Type | Description |
|---|---|---|
orderId | String | Order Id created by PhonePe |
state | String | State of the order. Initially it will be PENDING. |
expireAt | Long | Order expire date in epoch |
IntentUrl | String | Intent url according to the targetApp mentioned in the request |