UPI Intent
UPI Intent is one of the supported instruments available via the Java SDK’s pay() method. Based on the device OS, the targetApp field is configured differently.
Request
Request Parameters
| Parameter Name | Data Type | Mandatory | Description |
| String | No | The target app identifier for the UPI Intent flow. • For IOS: PHONEPE, GPAY, PAYTM. • For Android: com.phonepe.app, net.one97.paytm |
merchantOrderId | String | Yes | Unique merchant order id generated by merchant. |
amount | Long | Yes | Order amount in paisa. |
| List | No | Different type of constraints that must be applied to the payment. |
| String | No | Operating system of the device. Allowed values are: • iOS • ANDROID |
| String | No | Required only in case targetApp = PHONEPE and deviceOS = iOS |
Sample Request
import com.phonepe.sdk.pg.common.models.request.PgPaymentRequest;
import java.util.UUID;
import com.phonepe.sdk.pg.Env;
import com.phonepe.sdk.pg.payments.v2.CustomCheckoutClient;
import com.phonepe.sdk.pg.common.models.response.PgPaymentResponse;
String clientId = "<clientId>";
String clientSecret = "<clientSecret>";
Integer clientVersion = <clientVersion>; //insert your client version here
Env env = Env.SANDBOX; //change to Env.PRODUCTION when you go live
CustomCheckoutClient customCheckoutClient = CustomCheckoutClient.getInstance(clientId, clientSecret,
clientVersion, env);
String merchantOrderId = UUID.randomUUID()
.toString();
long amount = 100;
String deviceOS = "IOS";
String targetApp = "PHONEPE";
PgPaymentRequest pgPaymentRequest = PgPaymentRequest.UpiIntentPayRequestBuilder()
.merchantOrderId(merchantOrderId)
.amount(amount)
.targetApp(targetApp)
.deviceOS(deviceOS)
.build();
PgPaymentResponse pgPaymentResponse = customCheckoutClient.pay(pgPaymentRequest);
String intentUrl = pgPaymentResponse.getIntentUrl();Response
Extract the intentUrl from the response received.
| Field Name | Data Type | Description |
orderId | String | PG generated internal order id. |
state | String | State of the order created, initially it will be PENDING. |
expiryAt | Long | Order expiry date in epoch (in milliseconds). |
intentUrl | String | Intent url according to the targetApp mentioned in the request |