I am using webintent plugin for showing the installed UPI and doing the transaction with that UPI in IONIC 4. But I want to open only PhonePe, BHIM and Paytm and Google Pay applications. How can hide other UPI apps like CRED, AmazonPay, Whatsapp etc. Below is my code please suggest me.
payWithUPI() {
const packages = {
'paytm': 'net.one97.paytm',
'google': 'com.google.android.apps.nbu.paisa.user',
'bhim': 'in.org.npci.upiapp',
'phonepe': 'com.phonepe.app'
};
const tid = this.getRandomString();
const orderId = this.getRandomString();
const totalPrice = 1.00;
const UPI_ID = '9960777572@okbizaxis';
const UPI_NAME = 'Adhikar Patil';
const UPI_TXN_NOTE = 'TEST TXN';
let uri = `upi://pay?pa=${UPI_ID}&pn=${UPI_NAME}&tid=${tid}&am=${totalPrice}&cu=INR&tn=${UPI_TXN_NOTE}&tr=${orderId}`;
// uri = uri.replace(' ', '+');
(window as any).plugins.intentShim.startActivity(
{
action: this.webIntent.ACTION_VIEW,
url: uri,
requestCode: 1
}, intent => {
if (intent.extras.requestCode === 1 && intent.extras.resultCode === (window as any).plugins.intentShim.RESULT_OK && intent.extras.Status && (((intent.extras.Status as string).toLowerCase()) === ('success'))) {
alert("Payment Success");
}
else (intent.extras.requestCode === 1 && intent.extras.resultCode === (window as any).plugins.intentShim.RESULT_OK && intent.extras.Status && (((intent.extras.Status as string).toLowerCase()) === ('failed'))) {
alert("Payment Failed ") ;
}
}, err => {
alert('error ' + err);
});
}
getRandomString() {
const len = 10;
const arr = '1234567890asdfghjklqwertyuiopzxcvbnmASDFGHJKLQWERTYUIOPZXCVBNM';
let ans = '';
for (let i = len; i > 0; i--) {
ans += arr[Math.floor(Math.random() * arr.length)];
}
return ans;
}