Here is what I want to do. My app has two types of users - buyers and sellers. The seller can provide their UPI ID and buyers can use any UPI app installed on their device to pay to sellers using the provided seller UPI ID.
I am constructing a UPI payment URL as follows:
String upiPaymentUrl = upi://pay?pa=<<Seller VPA ID>>&pn=<<Payee name>>&tn=<<Txn description>>&cu=INR
I then use the following code to show all the UPI enabled apps on the phone:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(upiPaymentUrl));
Intent chooser = Intent.createChooser(intent, getString(R.string.payment_title));
startActivityForResult(chooser, Constant.REQUEST_CODE_UPIPAYMENT, null);
The selected UPI app is launched and the all the data I have given in the URI is filled properly. I then initiate the payment but the payment is always failing. When I use the UPI apps as is (without being invoked from my app) and use the same values that I use to construct the UPI URL, the payment goes through without any error. Any idea what could be causing the payment to fail when I invoke the UPI apps from my app?
Any help / suggestions will be highly appreciated!