flutter_paystack_plus 0.0.1 copy "flutter_paystack_plus: ^0.0.1" to clipboard
flutter_paystack_plus: ^0.0.1 copied to clipboard

Implement payment using Paystack.

A Flutter plugin for making payments via Paystack Payment Gateway. Fully supports Android, iOS and Web.

Features #

  • Mobile Money

  • VISA

  • Bank

  • Bank Transfer

  • USSD

  • QR

  • EFT

Getting started #

Before getting started, ensure you have succesfully created an account on paystack and you have your public key ready. Vist https://paystack.com to setup your account.

  1. Create a file on your web folder and call it "paystack_interop.js"

  2. Copy and paste the code below on the created folder

function paystackPopUp(publicKey, email, amount, ref, onClosed, callback) {
  let handler = PaystackPop.setup({
    key: publicKey,
    email: email,
    amount: amount,
    ref: ref,
    onClose: function () {
      alert("Window closed.");
      onClosed();
    },
    callback: function (response) {
      callback();
      let message = "Payment complete! Reference: " + response.reference;
      alert(message);
    },
  });
  return handler.openIframe();
}
  1. In your web/index.html file add the following code at the top of the body tag section
<body>
<script src="https://js.paystack.co/v1/inline.js"></script>
<script src="paystack_interop.js"></script>
...
...
</body>

Usage #

     FlutterPaystackPlus.openPaystackPopup(
      publicKey: '-Your-public-key-',
      email: 'youremail@gmail.com',
      amount: (amount * 100).toString(),
      ref: DateTime.now().millisecondsSinceEpoch.toString(),
      onClosed: () {
        debugPrint('Could\'nt finish payment');
      },
      onSuccess: () async {
        debugPrint('successful payment');
      },
    );

Additional information #

Here is a detailed example project => https://github.com/Princewil/flutter_paystack_plus_example

Please feel very free to contribute. Experienced an issue or want to report a bug? Please, feel free to report it. Remember to be as descriptive as possible. Thank you.

20
likes
0
points
938
downloads

Publisher

unverified uploader

Weekly Downloads

Implement payment using Paystack.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, js

More

Packages that depend on flutter_paystack_plus