Invoke PSP app with UPI url

时光毁灭记忆、已成空白 提交于 2019-12-03 15:05:31

Found the correct way to do that. You need to frame the URL in the proper way as mentioned in the question. After that, this URL has to be converted to URI and sent as data to the intent.

Intent intent = new Intent();
intent.setData(Uri.parse(UPI));
Intent chooser = Intent.createChooser(intent, "Pay with...");
startActivityForResult(chooser, 1, null);

After that, in your onActivityResult, check for the requestCode and id received intend data is null. If not, then the data will contain a stringExtra as response. This response will contain the status, transaction reference, transactionId and the response code.

Also, spaces in the url should be replaced with a '+' and not with '%'.

For an App to show up as the UPI intent receiver it needs to register this UPI uri in its Manifest file so that it can listen to this type of broadcast intent thrown by other Applications . Tried this via web and i was able to bring up "Phone Pe" app to pay for that particular Application . I have Bhim and Icici installed as well in my phone but they did not show up and "Phone Pe" was brought up by default, so i am assuming that they did not have the UPI uri Intent registered with them .

Edit : Android App to App I can open Phone Pe and BHIM , ICICI app i guess doesn't have this intent Registered so it did not show up.

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