1

To start with -

I am aware that there is a similar question out there which is answered. However the answer is not helping me.

Invoke PSP app with UPI url

My Problem is same -

Using UPI url as below

    String UPI = "upi://pay?pa=xsas@hdfcbank&pn=ABC+DEF&mc=qy67vt&tr=12121&tn=your+order+with+us&am=1.5&url=shopify.com";
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    intent.setData(Uri.parse(UPI));
    Intent chooser = Intent.createChooser(intent, "Pay with...");
    startActivityForResult(chooser, 1, null);

The moment I use setData, I stop getting list of Apps with which I can share this (the list is empty). If I remove setData, the regular list of Apps (sms, email etc) start popping and bank app (which accepts UPI, say ICICI/HDFC) is not one of them.

What could be going wrong here?,

Rahul Tiwari
  • 6,851
  • 3
  • 49
  • 78
anikaran
  • 11
  • 2

2 Answers2

0

Replace this:

String UPI = "upi://pay?pa=xsas@hdfcbank&pn=ABC+DEF&mc=qy67vt&tr=12121&tn=your+order+with+us&am=1.5&url=shopify.com";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setData(Uri.parse(UPI));
Intent chooser = Intent.createChooser(intent, "Pay with...");
startActivityForResult(chooser, 1, null);

with this:

String UPI = "upi://pay?pa=xsas@hdfcbank&pn=ABC+DEF&mc=qy67vt&tr=12121&tn=your+order+with+us&am=1.5&url=shopify.com";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW); // this line needs to be updated
intent.setData(Uri.parse(UPI));
Intent chooser = Intent.createChooser(intent, "Pay with...");
startActivityForResult(chooser, 1, null);

This is because for all the deeplinked upi apps to handle the incoming intent, they need to be called with View Action.

ankur_gaur
  • 21
  • 2
  • This update also does not work. intent.setAction(Intent.ACTION_VIEW); also I am getting undefined response while using "pockets" app of icici – Rajdeep Paliwal Apr 12 '17 at 06:57
0

you can omit the intent.setAction(Intent.ACTION_SEND); part from your intent as that's not mandatory and different apps will handle different actions.

as you can see in the original question you referred there is no setAction

Rahul Tiwari
  • 6,851
  • 3
  • 49
  • 78