iosflutterurllauncherupi

Flutter upi integration for ios


I am trying to implement a functionality in my Flutter app where a user can tap on "Pay via GooglePay" button and it opens the GooglePay app with pre-filled amount and merchant details. I have tried using upi_package and other packages, but on iOS, it randomly opens any UPI app instead of GooglePay. Is there any way to achieve this functionality using URL schemes without using an package? If yes, how can I implement it specifically for iOS in my Flutter app

I have already tried it using url launcher, by creating url like

void _launchURL() async {
  String _url='upi://pay?pa=xxx@okicici&pn=Test&am=1&tn=Test Payment&cu=INR';
    var result = await launch(_url);
     debugPrint(result.toString());
     if (result ==true) {
       print("Done");
     } else if (result ==false){
       print("Fail");
     }
  }

But this url is not wokring on ios. Please suggest something.


Solution

  • As suggested in google pay guide you should prefix your URL with gpay.