I've seen many tutorials out there for integrating upi intent in the app but no matter what I use the code in the tutorials cannot recognize any payments app such as phonepe, googlepay, paytm etc. I've used library also such as EasyUpiPayment by - shreyas patil but it always give one callback which is no apps to perform this action. What I've tried till now,
- Basically all the tutorials are in the same range of code like this, creating an intent and checking if there's any app to perform the action. And sometimes a chooser which will not show any app at all.
String GOOGLE_PAY_PACKAGE_NAME = "com.google.android.apps.nbu.paisa.user";
int GOOGLE_PAY_REQUEST_CODE = 123;
Uri uri =
new Uri.Builder()
.scheme("upi")
.authority("pay")
.appendQueryParameter("pa", "your-merchant-vpa@xxx")
.appendQueryParameter("pn", "your-merchant-name")
.appendQueryParameter("mc", "your-merchant-code")
.appendQueryParameter("tr", "your-transaction-ref-id")
.appendQueryParameter("tn", "your-transaction-note")
.appendQueryParameter("am", "your-order-amount")
.appendQueryParameter("cu", "INR")
.appendQueryParameter("url", "your-transaction-url")
.build();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
intent.setPackage(GOOGLE_PAY_PACKAGE_NAME);
activity.startActivityForResult(intent, GOOGLE_PAY_REQUEST_CODE);
- I've used a library called EasyUpiPayment by Shreyas Patil, in which there are couple of callback methods and each time it returns that there is no app. I checked the github repo for issues and found out that the merchant upi id must be business upi id .. I did that too. Then I found out that merchant id or merchant code is a must nowadays. so I provided a fake one from a list of valid merchant code but it still returns the same.
PS. One interesting thing to note, when I created and used the intent to call for upi apps and when I did not login from the payment app with any account, it automatically did open paytm and razorpay once. But I couldn't make any conclusion from it.