在iOS中使用深层链接进行UPI集成

时间:2020-04-14 12:27:15

标签: ios swift google-pay upi

当用户通过UPI点击Pay时,我正在打开Goog​​lePay,PhonePe或PayTM应用。

根据NPCI文档https://www.npci.org.in/sites/default/files/UPI%20Linking%20Specs_ver%201.6.pdf,当我尝试打开 upi:// pay?parm-name = param-value&param-name = pram-value&... 或本质上<从移动浏览器中strong> upi:// ,它会随机打开任何已安装UPI的应用程序(在我的情况下为whatsApp),如果未安装whatsApp,则会打开PayTM。

我希望应用程序中有一种行为,如果用户点击通过GooglePay付款,则GooglePay应用程序应打开并带有预填充的金额,并链接商户,就像CRED应用程序一样。

如何实现类似的功能?

我尝试了 tez:// 的PS,它会打开Goog​​lePay应用程序,但未在任何地方进行记录,因此我不知道我是否可以依靠它。

编辑:是否可以在不使用SDK的情况下实现?我只想使用URL方案来实现它。

1 个答案:

答案 0 :(得分:1)

这也没有记录,但是您可能要尝试的两种方案是:

  • // Testing with notch hidden; the screen is pushed down below it DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); // 1080x2062 (-notification bar height!) getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics); // 1080x2192 (actual window height when notch is hidden)
  • tez://upi/*

如果我不得不猜测哪个会得到更好的支持,那就是gpay://upi/*选项。

更新

我已经尝试过了,但看起来不像我在上面的工作中提供的URI。参见https://internal-absorbed-celsius.glitch.me/