UPI Smart Intent - Non SDK Flow
The Non SDK implementation for finding the UPI supported application in the customer's device. The following steps will help you first find the application installed in the customer’s device supporting smart intent.
You can use PayU APIs to initiate the transaction and get the Intent payment URI which includes payment details required for the PSP app customer will select for payment. After completion of payment by the customer, you can verify the transaction using the Verify Payment API. The following steps are required to enable Smart Intent-based UPI payment in your application.
Step 1: Update Manifest File
Add package ids in your apps manifest file to allow your application to access apps installed on the customer's device. This is required for Android 11 and above.
<queries>
<package android:name="in.amazon.mShop.android.shopping"/>
<package android:name="com.upi.axispay"/>
<package android:name="com.axis.mobile"/>
<package android:name="com.fisglobal.bandhanupi.app"/>
<package android:name="com.bankofbaroda.upi"/>
<package android:name="in.org.npci.upiapp"/>
<package android:name="com.canarabank.mobility"/>
<package android:name="com.citiuat"/>
<package android:name="com.dbs.in.digitalbank"/>
<package android:name="com.olive.dcb.upi"/>
<package android:name="com.finopaytech.bpayfino"/>
<package android:name="com.freecharge.android"/>
<package android:name="com.google.android.apps.nbu.paisa.user"/>
<package android:name="com.snapwork.hdfc"/>
<package android:name="com.mgs.hsbcupi"/>
<package android:name="com.csam.icici.bank.imobile"/>
<package android:name="com.icicibank.pockets"/>
<package android:name="com.euronet.iobupi"/>
<package android:name="com.mgs.induspsp"/>
<package android:name="com.fss.jnkpsp"/>
<package android:name="com.jio.myjio"/>
<package android:name="com.mycompany.kvb"/>
<package android:name="com.kvb.mobilebanking"/>
<package android:name="com.lcode.smartz"/>
<package android:name="com.msf.kbank.mobile"/>
<package android:name="com.upi.federalbank.org.lotza"/>
<package android:name="com.infrasofttech.mahaupi"/>
<package android:name="com.mipay.in.wallet"/>
<package android:name="com.myairtelapp"/>
<package android:name="com.mobikwik_new"/>
<package android:name="com.onymy.paybee.prod"/>
<package android:name="net.one97.paytm"/>
<package android:name="com.phonepe.app"/>
<package android:name="com.Version1"/>
<package android:name="com.samsung.android.spay"/>
<package android:name="com.sbi.upi"/>
<package android:name="com.SIBMobile"/>
<package android:name="com.truecaller"/>
<package android:name="com.infrasoft.uboi"/>
<package android:name="com.lcode.ucoupi"/>
<package android:name="com.YesBank"/>
<package android:name="com.dreamplug.androidapp"/>
<package android:name="money.bullet"/>
</queries>
Step 2: Fetch the List of UPI and Smart Intent Supported Apps
You need to get the list of UPI and smart intent supported applications installed in the device.
private fun getSmartIntentUPIApps(context: Context?):ArrayList<HashMap<String,String>>?{
val upiApps = ArrayList<HashMap<String, String>>()
if (context == null)
return null
val intent = Intent()
intent.data = Uri.parse("upi://pay")
val activityList = context.packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
for (resolveInfo in activityList){
var packageInfo: PackageInfo? = null
try {
packageInfo = context.packageManager
.getPackageInfo(resolveInfo.activityInfo.packageName, 0)
val name =
context.packageManager.getApplicationLabel(packageInfo.applicationInfo) as String
val appInfo = HashMap<String, String?>()
appInfo["bankName"] = name ?: "NA"
appInfo["packageName"] = packageInfo.packageName
upiApps.add(appInfo)
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
return upiApps
}
}
return UPI apps
}
/* to get icon of psp app*/
fun getUpiAppBitmap(context: Context?, packageName: String): Bitmap? {
var upiAppBitmap: Bitmap? = null
if (context == null)
return upiAppBitmap
upiAppBitmap = context.packageManager.getApplicationIcon(packageName).toBitmap()
return upiAppBitmap
}
Step 3: Get Intent URI
Use the _payment API to get Intent URI and transaction details for the UPI app selected by the customer. For more information, refer to Payments API.
Step 4: Start Activity
Start activity using package id and Intent URI. After the intent UI you get from the _payment API, you need to add “upi://pay“ as a prefix.
fun makePayment(packageName: String,mActivity: Activity,intentUri:String) {
val i = Intent()
i.setPackage(packageName)
i.action = Intent.ACTION_VIEW
i.data = Uri.parse("upi://pay" + intentUri)
if (null != mActivity && !mActivity.isFinishing() && !mActivity.isDestroyed()) {
mActivity.startActivityForResult(i, 101)
}
}
Step 5: Get Callback
Get a callback in onActivityResult
for the status of the transaction. Refer to Verify Payment API to get the final status of the transaction.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == 101) {
data?.getStringExtra("Status")?.let { Log.d("result", it) }
data?.getStringExtra("response")?.let { Log.d("response", it) }
//get Status
//if Status == Success
// Call Verify Payemnt//
}
}
Updated 6 months ago