从我的react本机应用程序调用UPI应用程序在iOS中有效,但在Android中无效
我正在尝试使用深度链接调用一些常见的UPI应用程序Google Pay、Phone Pay和PayTM openPaymentApp=异步payApp=>{ 设url=; switchpayApp{ 案例'PAYTM':url='paytmmp';中断; 案例“GPAY”:url=“GPAY”;中断; 案例'PHONEPE':url='PHONEPE';中断; } url=url+'://upi/pay?pa=7024293076@upi&pn=DK Bose&mc=0000&tr=123456789ABCDEFG&tn=HelloWorld&am=11&cu=INR' console.log'URL:',URL; 试一试{ 等待Linking.openURLurl; } 犯错误{ console.error'error:',err; } } 渲染{ 回来 this.openPaymentApp'PAYTM'}/> this.openPaymentApp'GPAY'}/> this.openPaymentApp'PHONEPE'}/> ; } 它在iOS中运行良好,即打开深度链接时,相应的应用程序会打开,应用程序会自动跳转到UPI支付页面,其中包含预填充的VPA、姓名、金额、备注等字段 但在Android上,我有以下问题: GPay:应用程序未打开。 Paytm:应用程序打开,但不进入UPI支付页面 PhonePe:应用程序打开,但不转到UPI付款页面 当我尝试使用默认的upi deeplink时,android上会弹出一个选择upi应用程序的窗口。但只有来自ICICI的Google Pay和iMobile在弹出窗口中列出,Paytm和Phonepe没有在弹出窗口中列出从我的react本机应用程序调用UPI应用程序在iOS中有效,但在Android中无效,android,react-native,google-pay,paytm,upi,Android,React Native,Google Pay,Paytm,Upi,我正在尝试使用深度链接调用一些常见的UPI应用程序Google Pay、Phone Pay和PayTM openPaymentApp=异步payApp=>{ 设url=; switchpayApp{ 案例'PAYTM':url='paytmmp';中断; 案例“GPAY”:url=“GPAY”;中断; 案例'PHONEPE':url='PHONEPE';中断; } url=url+'://upi/pay?pa=7024293076@upi&pn=DK Bose&mc=0000&tr=123456
upi://pay?pa=7024293076@upi&pn=DK...
对于iOS和Android,UPI支付应用程序的深度链接是否有所不同
要打开应用程序并转到带有预填充字段的UPI支付页面,还需要做些什么?我用一种方法解决了这个问题,但这不是我所知道的最好的解决方案。到目前为止,我通过将其重定向到params中的浏览器来解决问题,并从浏览器打开intent链接 范例- 有限公司&tr=12703860471&tid=COBya9xXv2VWZ7Zc&am=4.00&cu=INR&tn=OrderId-COBya9xXv2VWZ7Zc;方案=upi;package=com.phonepe.app;美国浏览器\u回退\u url=https://play.google.com/store/apps/details?id=com.phonepe.app&hl=en_IN;结束
收到付款信息后,我将使用Windows在浏览器中打开。openpaymentinfo这些android应用程序的深层链接包括: Paytm:
paytmmp://pay?pa=your@vpa&pn=YourName&tn=Note&am=1&cu=INR
电话号码:
phonepe://pay?pa=your@vpa&pn=YourName&tn=Note&am=1&cu=INR
GPay
这就是您正在寻找的解决方案。 代码应该如下所示:
openPaymentApp = async (payApp) => {
let url = '';
switch(payApp) {
case 'PAYTM' : url = 'paytmmp://'; break;
case 'GPAY' : url = 'tez://upi/'; break;
case 'PHONEPE' : url = 'phonepe://'; break;
}
url = url + 'pay?pa=7024293076@upi&pn=DK Bose&mc=0000&tr=123456789ABCDEFG&tn=HelloWorld&am=11&cu=INR'
console.log('URL : ',url);
try {
await Linking.openURL(url);
}
catch (err) {
console.error('ERROR : ',err);
}
}
render(){
return (
<View style={{alignItems:"center",justifyContent:"center",flex:1}}>
<Button title='PAYTM' onPress={() => this.openPaymentApp('PAYTM')}/>
<Button title='GPAY' onPress={() => this.openPaymentApp('GPAY')}/>
<Button title='PHONE PE' onPress={() => this.openPaymentApp('PHONEPE')}/>
</View>
);
}
希望这有帮助。干杯
openPaymentApp = async (payApp) => {
let url = '';
switch(payApp) {
case 'PAYTM' : url = 'paytmmp://'; break;
case 'GPAY' : url = 'tez://upi/'; break;
case 'PHONEPE' : url = 'phonepe://'; break;
}
url = url + 'pay?pa=7024293076@upi&pn=DK Bose&mc=0000&tr=123456789ABCDEFG&tn=HelloWorld&am=11&cu=INR'
console.log('URL : ',url);
try {
await Linking.openURL(url);
}
catch (err) {
console.error('ERROR : ',err);
}
}
render(){
return (
<View style={{alignItems:"center",justifyContent:"center",flex:1}}>
<Button title='PAYTM' onPress={() => this.openPaymentApp('PAYTM')}/>
<Button title='GPAY' onPress={() => this.openPaymentApp('GPAY')}/>
<Button title='PHONE PE' onPress={() => this.openPaymentApp('PHONEPE')}/>
</View>
);
}