ippopay_payment

A Flutter plugin for making payments via Ippopay Payment Gateway. Fully supports Android and iOS.

💻 Installation

In the dependencies: section of your pubspec.yaml, add the following line:

ippopay_payment_test: ^0.0.1

Import in your project:

import 'package:ippopay_payment_test/ippopay_payment_test.dart';

❔Basic Usage

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();

bool proceedToPayment = false;

  void _proceeedToPayment() {
    setState(() {
      proceedToPayment = true;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffoldKey,
      appBar: proceedToPayment
          ? null
          : AppBar(
              title: Text('Ippopay Payment Flutter'),
            ),
      body: proceedToPayment
          ? IppopayPayment(
              headerText: 'Ippopay Payment',
              loaderText: 'Processing Request',
              merchantKey: 'YOUR_IPPOPAY_PUBLIC_KEY',
              onError: (value) {
                print("Payment Error : $value");
                setState(() {
                  proceedToPayment = false;
                });
                _scaffoldKey.currentState.showSnackBar(SnackBar(
                  content: Text(value.toString()),
                  duration: Duration(seconds: 3),
                ));
              },
              onSuccess: (value) {
                print("Payment Success : $value");
                setState(() {
                  proceedToPayment = false;
                });
                _scaffoldKey.currentState.showSnackBar(SnackBar(
                  content: Text(value.toString()),
                  duration: Duration(seconds: 3),
                ));
              },
            )
          : Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  RaisedButton(
                    onPressed: _proceeedToPayment,
                    child: new Text(
                      "Proceed to Payment",
                    ),
                  )
                ],
              ),
            ),
    );
  }
}

Note: If you're using the Ippopay public key as a string in flutter, remember to escape the $ dollar signs although it is recommended to load these from your backend

publicKey: 'pktest_*\$2y\$10\$PQ8r...',

Properties

Here is a list of properties available:

NameTypeRequiredDescription
headerTextStringfalsethe title of the widget's appbar
onErrorFunctiontruefunction to run on payment error
onSuccessFunctiontruefunction to run on payment success
loaderTextStringfalsetext to display under the loader
publicKeyStringtrueyour ippopay public key
orderIdStringfalsethe order id - generates automatically if null
paymentCancellationMsgStringfalsemessage returned when user cancels the payment
debugModeboolfalseto enable or disable package logs
allowNavigationboolfalseto allow route navigation away from payment screen
onNavigateFunction-callback function that is triggered when navigation is attempted.

Author

This component is written by IppoPay.

License

IppoPay 2020 © All Rights Reserved. IppoPay

Libraries

ippopay_payment_test