[英]Invoking UPI apps from my react-native App works in iOS but not in Android
I am trying to invoke few common UPI Apps ( Google Pay
, Phone Pay
, PayTM
) using deep links
.我正在尝试使用deep links
调用一些常见的 UPI 应用程序( Google Pay
、 Phone Pay
、 PayTM
)。
openPaymentApp = async (payApp) => {
let url = '';
switch(payApp) {
case 'PAYTM' : url = 'paytmmp'; break;
case 'GPAY' : url = 'gpay'; break;
case 'PHONEPE' : url = 'phonepe'; break;
}
url = url + '://upi/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>
);
}
It works fine in iOS, ie on opening the Deep Links the respective apps open up and the app automatically jumps to the UPI payments page with pre filled fields of VPA, Name, Amount, Note etc.它在 iOS 中运行良好,即在打开相应应用程序的深层链接时,应用程序会自动跳转到 UPI 支付页面,其中预先填写了 VPA、名称、金额、注释等字段。
But on Android i have following problems:但是在 Android 我有以下问题:
GPay
: App does not open. GPay
:应用程序无法打开。Paytm
: App opens but does not go to UPI payments page Paytm
:应用程序打开但 go 到 UPI 付款页面PhonePe
: App opens but does not go to UPI payments page PhonePe
:应用程序打开但 go 到 UPI 付款页面When I tried using default upi deeplink, on android it gives a popup to select a UPI app.当我尝试使用默认的 upi 深层链接时,在 android 上它会弹出一个 UPI 应用程序 select。 But only Google Pay and iMobile (from ICICI) are listed there, Paytm and Phonepe are not listed in that popup.但是那里只列出了 Google Pay 和 iMobile(来自 ICICI),Paytm 和 Phonepe 没有在该弹出窗口中列出。
upi://pay?pa=7024293076@upi&pn=DK...
Are Deeplinks
for UPI payment Apps different for iOS and Android? iOS 和Deeplinks
的 UPI 支付应用程序的深层链接是否不同?
What else needs to be done to open the App and move to UPI payment page with pre filled fields?还需要做什么才能打开应用程序并移动到预填字段的 UPI 支付页面?
Working deep links for these android apps are:这些 android 应用程序的工作深层链接是:
Paytm:支付宝:
paytmmp://pay?pa=your@vpa&pn=YourName&tn=Note&am=1&cu=INR
Phonepe:电话:
phonepe://pay?pa=your@vpa&pn=YourName&tn=Note&am=1&cu=INR
GPay支付宝
tez://upi/pay?pa=your@vpa&pn=YourName&tn=Note&am=1&cu=INR
I am solving in one way but it's not the best solution I know.我正在以一种方式解决,但这不是我所知道的最佳解决方案。 So far i am solving the issue by redirecting it to a browser in params and from browser i am opening intent link.到目前为止,我正在通过将其重定向到 params 中的浏览器并从浏览器中打开意图链接来解决问题。
Example-例子-
www.website.com?paymentinfo=intent://pay?pa=payu@axisbank&pn=company LIMITED&tr=12703860471&tid=COBya9xXv2VWZ7Zc&am=4.00&cu=INR&tn=OrderId-COBya9xXv2VWZ7Zc#Intent;scheme=upi;package=com.phonepe.app;S.browser_fallback_url=https://play.google.com/store/apps/details?id=com.phonepe.app&hl=en_IN;end www.website.com?paymentinfo=intent://pay?pa=payu@axisbank&pn=company LIMITED&tr=12703860471&tid=COBya9xXv2VWZ7Zc&am=4.00&cu=INR&tn=OrderId-COBya9xXv2Vupi;package=com.phonepe.cheme=VWZ7C# S.browser_fallback_url=https://play.google.com/store/apps/details?id=com.phonepe.app&hl=en_IN;end
after receiving payment info i am opening in browser using window.open(paymentinfo)收到付款信息后,我使用window.open(paymentinfo)在浏览器中打开
This is the solution you are looking for.这是您正在寻找的解决方案。 The code should look something like this:代码应如下所示:
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>
);
}
Hope this helps.希望这可以帮助。 Cheers!干杯!
I have try this link but show any error show this image Some thing went wrong please try sometime我已尝试此链接,但显示任何错误显示此图像出了点问题,请稍后再试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.