androidandroid-intentupi

Launching payments app like Phonepay via intent Android


There are similar questions on StackOverflow but none of them worked for me.

List of Questions

  1. UPI Payment Gateway using Android Deep Link
  2. UPI App Deep linking using Intent - inconsistent and buggy behavior

Somehow I managed to open Uri starting with upi://pay using startActivity(new Intent(ACTION_VIEW).setData(Uri.parse(upi_string))); However when I try to use createChooser, no app is detected which can handle UPI payments.

How do I create a chooser for UPI apps?


Solution

  • enter image description here I am using flutter and in my app when i tap on google pay or any upi app icon a url launcher is launched the function is:

    _launchgooglepay() async {
      const url =
          'upi://pay?pa=kechamadavipul@okhdfcbank&pn=Payee Name&tn=Payment Message&cu=INR';
      if (await canLaunch(url)) {
        await launch(url);
      } else {
        throw 'Could not launch $url';
      }
    }
    

    The url

    upi://pay?pa=kechamadavipul@okhdfcbank&pn=Payee Name&tn=Payment