26

How can I integrate a payment gateway in flutter framework. Is there any libraries I can use readily? Do I need to do it separately in iOS and Android? In that case which is the best library available in India? Check out the new package for making payment https://pub.dev/packages/flutter_paystack

Ambareesh B
  • 499
  • 1
  • 5
  • 14
  • My client suggest me this website https://www.instamojo.com ,and I have seen a video for android implementation, its called Instamojo,in this https://www.youtube.com/watch?v=2x6xlnYnHjc ....A guy just installs and EXE and that adds extra lines in gradle automatically,so i hope if i Choose flutterprojectfolder/android then it will add the same magic for flutter too,but not yet tried, if my perception is wrong then pls anyboy tell,how to get a raw Android folder(As like Native flutter) Folder, from a flutter folder – Rajesh Jul 20 '18 at 18:19
  • Razorpay has released a fluttter package for their payment services. https://github.com/razorpay/razorpay-flutter – Akas Antony Oct 15 '19 at 08:20

2 Answers2

23

There are no payment plugins for flutter yet.

To integrate payments into a flutter app, just integrate payments natively and invoke it by implementing a platform channel.

An example of platform channel implementation is shown here.

Hope that helped!

Hemanth Raj
  • 32,555
  • 10
  • 92
  • 82
  • Hi Ambareesh, in our app we have integrated upi payments but only received success messages in to flutter app if the payments are done through tez/bhim or paytm but not the other types of upi payments like phonepe etc. Well we have done exactly what Hemanth suggested – Mahi Mar 02 '18 at 07:45
  • 1
    This answer needs some updating because nowadays there are some pay plugins available in 2021: https://pub.dev/packages/pay and https://pub.dev/packages/flutter_stripe . –  Nov 24 '21 at 08:11
  • We have open source the juspay-flutter sdk We use it in production -https://github.com/deep-rooted-co/juspay_flutter – Srikanth Dec 27 '21 at 08:54
8

I was able to integrate stripe using webview & flutter_webview_plugin

 String test = "Test Charge";
 int amount = 100;
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
        home: new WebviewScaffold(
      url: new Uri.dataFromString('''
      <html>
        <head>
         <meta name="viewport" content="width=device-width">
        </head>
        <center>
          <body>      
            <form action="Your Server" method="POST">
              <script
                src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                data-key="pk_test_key"
                data-amount="$amount"
                data-name="$test"
                data-description="My Order"
                data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                data-locale="auto"
                data-currency="eur">
              </script>
            </form>            
          </body>
        </center>
      </html>
            ''', mimeType: 'text/html').toString(),
    ));
  }

you'll need to set up a server for live payments. More info can be found: https://stripe.com/docs/checkout#integration-simple

JAAYBone
  • 183
  • 2
  • 7