UPI Deeplinking from IONIC to GooglePay does not work as expected

旧城冷巷雨未停 提交于 2019-12-23 05:10:16

问题


We have developed an IONIC based mobile app to perform In-App payment using UPI. It uses IONIC Native Web Intent plugin. a. b. "@ionic-native/web-intent": "^4.14.0",

This is shim layer for the Android intent mechanism and makes web intent call to BHIM/PhonePe/GooglePay

It works well with all UPI apps like BHIM, PhonePe. But does not work with GooglePay, For some reason with same code , Google Pay returns NULL Intent to OnActivityResult() even though the UPI Payment is successful.

  1. I wrote similar functionality in a sample Native Android app and tried payment with GooglePay and it works

  2. So I am baffled. I did debug my IONIC app and that is where I found that after GooglePay payment is successful, the call back returns to Android and then to Cordova and then to my application. It seems either Intent code of Android or GooglePay code is sending null Intent to caller app.

Appreciate any feedback on this.

Thank you and warm regards

Haresh Gujarathi


回答1:


Below is the code i'm using in my Ionic project for UPI payment in Android. I'm able to get response from Google pay. I have tested this with Paytm, Whatsapp and Google pay.

// I'm using this to open the app user has choosen to pay with
private packages = {
  'paytm': 'net.one97.paytm',
  'google': 'com.google.android.apps.nbu.paisa.user',
  'whatsapp': 'com.whatsapp'
};
// Deep link URL
const url = 'upi://pay?pa=<UPI ID>&pn=<Payee name>&tr=<Transaction ID>&tn=<id>&am=<amount>&cu=INR';
// Deep link options
const options = {
  action: this.webIntent.ACTION_VIEW,
  url,
  package: this.packages[serviceName]
};
// Open the intent with options
this.webIntent.startActivityForResult(options).then(console.log, console.error);


来源:https://stackoverflow.com/questions/52453686/upi-deeplinking-from-ionic-to-googlepay-does-not-work-as-expected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!