3

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,

  1. 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);
  1. 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.

Jamid Deka
  • 41
  • 3
  • Were you able to figure out a solution? I added the library as a module and have modified the code to include mode as a mandatory feature. For Google Pay, mode=02 works fine and all transactions happen but other apps such as PayTM, PhonePe etc are reject the transaction stating one or the other reasons such as : "Your payment failed as the payment mode is not allowed for this UPI ID". – Kavach Chandra Feb 06 '22 at 03:44
  • https://stackoverflow.com/q/76988284 can anyone solve this? – George Aug 28 '23 at 08:25

0 Answers0