Android PG SDKLess Integration

Steps to Integrate PG SDKLess UPI Open Intent Flow (ANDROID)

  1. Get the list of UPI Apps installed on the user’s device using the below code snippet.
private ArrayList < String > getInstalledUPIApps() {
    ArrayList < String > upiList = new ArrayList < > ();
    Uri uri = Uri.parse(String.format("%s://%s", "upi", "pay"));
    Intent upiUriIntent = new Intent();
    PackageManager packageManager = getApplication().getPackageManager();
    List < ResolveInfo > resolveInfoList = packageManager.queryIntentActivities(upiUriIntent, PackageManager.MATCH_DEFAULT_ONLY);
    if (resolveInfoList != null) {
        for (ResolveInfo resolveInfo: resolveInfoList) {
    return upiList;
  1. Add the below line to your AndroidManifest.xml file
    Note: If you declare a element in your app’s manifest file, then the app associated with that package name appears in the results of any query to PackageManager that matches a component from that app.
    <package android:name="" />								// PhonePe Prod
    <package android:name="" />						// PhonePe UAT
    <package android:name="" />		// GPay
  	<package android:name="net.one97.paytm" />								// Paytm
  	<package android:name="" />							// BHIM
		<package android:name="" />			// AmazonPay
  1. Display the custom UI containing the list of UPI apps obtained from Step 1. on the checkout page under the UPI section.

Make Sure packageName is accessible when the user selects any of the UPI Applications.

  1. When the user selects any of the UPI apps to initiate the payment, then you must pass the following parameters in the PAY API request payload based on the app selected by the user and the device platform.
  • deviceContext.deviceOS – Possible Values: ANDROID, IOS
  • paymentInstrument.type – “UPI_INTENT
  • app – The package name of the UPI app selected by the user to initiate the payment.
    Example: PhonePe App – ““, Gpay App – ““, etc.
  "merchantId": "MERCHANTUAT",
  "merchantTransactionId": "MT7850590068188104",
  "merchantUserId": "MU933037302229373",
  "amount": 10000,
  "callbackUrl": "",
  "mobileNumber": "9999999999",
  "deviceContext": {
    "deviceOS": "ANDROID"
  "paymentInstrument": {
    "type": "UPI_INTENT",
    "targetApp": ""
  "success": true,
  "message": "Payment Initiated",
  "data": {
    "merchantId": "MERCHANTUAT",
    "merchantTransactionId": "OD620471739210623",
        "instrumentResponse": {
            "type": "UPI_INTENT",
            "intentUrl": "upi://pay?pa=MERCHANTUAT@ybl&pn=MerchantUAT&am=3.00&mam=3.00&tr=OD620471739210623&tn=Payment%20for%OD620471739210623&mc=5311&mode=04&purpose=00&utm_campaign=DEBIT&utm_medium=FKRT&utm_source=OD620471739210623"
  1. After calling the PAY API, you will receive the intentUrl in response. You have to invoke the app-specific Intent using the received intentUrl. Use the below code snippet to invoke app-specific Intent.

Update the APP_PACKAGE value with the package name of the UPI app selected by the user on the merchant’s checkout page to launch the payment.

private static int B2B_PG_REQUEST_CODE = 777;

val intent = Intent()
intent.action = Intent.ACTION_VIEW = Uri.parse(redirectUrl)	//PhonePe Intent redirectUrl from the response.
intent.setPackage(APP_PACKAGE)      	//APP_PACKAGE will be the package name of the App selected by the user.

// To Initiate Payment.
  1. After the payment completion, once you get the UI control back to the merchant app, check for the payment status with your backend server. You can rely on a Server-to-Server callback response. If not received, you must call the Check Status API.

Override onActivityResult to receive the UI Callback after the payment completion.

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == B2B_PG_REQUEST_CODE) {
      /*This callback indicates only about completion of UI flow.
            Inform your server to make the transaction
            status call to get the status. Update your app with the
            success/failure status.*/
  1. Once the payment status is validated against the order, fulfill the order.