flutter_bani_checkout 0.0.3 copy "flutter_bani_checkout: ^0.0.3" to clipboard
flutter_bani_checkout: ^0.0.3 copied to clipboard

Make Payments Seamless with Bani using either BaniShopperCheckout widget, or BaniShopper.checkoutModalSheet bottom sheet.

Flutter Bani Checkout #

Integrate Bani Checkout Seamlessly into your Flutter Applications using this package!

Installation #

Run this in your workspace terminal

flutter pub add flutter_bani_checkout

Import the package in your application

import 'package:flutter_bani_checkout/flutter_bani_checkout.dart';

This package works using Riverpod. So we wrap the MyApp method in main with ProviderScope as shown below

void main() {
  runApp(const ProviderScope(
    child: MyApp(),
  ));
}

Android Requirements #

The minium sdk version should be set to 19 in the android/app/build.gradle.

android {
    defaultConfig {
        minSdkVersion 19
    }
}

Features #

Make use of either BaniShopperCheckout Widget in a stand alone page, or BaniShopper.checkoutModalSheet bottom sheet.

BaniShopperCheckout #

This Widget takes a custom class, BaniObject as a required property.

  final String text; // Text to be displayed to user
  final String amount; // Amount to be purchased
  final String phoneNumber; // Phone number of user in ITU standard Eg: +234 xxx xxxx xxxx
  final String merchantKey; //Merchant Key
  final String ref; // Transaction Reference. Should be a unique String
  final String email; //User Email
  final String firstName; // User First name
  final String lastName; // Users Last Name
  final Map<String, dynamic> metaData; // Metea Data

Optional Functions listed below can be given to be notified when an Event Response is receieved from the Widget.

  • onClose: This function is called whenever the Widget or Modal is closed or dismissed.
  • onSuccess: This function is called whenever a successful transaction has been carried out.
  • onCustomerExists: This function is called on confirmation of a valid Customer.
  • onCheckOutClose: This function is called after a successful payment has been receieved and widget closed.

The EventResponse class returned, contains the transaction reference and customer Ref

Example

  BaniShopperCheckout(
        baniObject: BaniObject(
          text: "Pay with Bani",
          amount: "200",
          phoneNumber: "+23408039485758",
          merchantKey: "pub_test_KB9A23HSYR327H5DKW45Y",
          ref: "ref-${Random.secure().nextInt(900000) + 100000}",
          email: "usercustomer@gmail.com",
          firstName: "John",
          lastName: "Doe",
          metaData: {
            "order_ref": "fake_0rderre6",
          },
        ),
        onSuccess: (eventResponse){
            dev.log("Success!");
        },
        onClose: (eventResponse) {
          dev.log(event.toString());
          dev.log("Closed!");
        },
      ),
await BaniShopper.checkoutModalSheet(
              context: context,
              baniObject: BaniObject(
                text: "Pay with Bani",
                amount: "200",
                phoneNumber: "+23408038475839",
                merchantKey: "pub_test_KB9A23HSYR327H5DKW45Y",
                ref: "ref-${Random.secure().nextInt(900000) + 100000}",
                email: "usercustomer@gmail.com",
                firstName: "John",
                lastName: "Doe",
                metaData: {
                  "order_ref": "fake_0rderre6",
                },
              ),
              // onClose: onClose,
              // onSuccess: onSuccess,
              // onCustomerExists: onCustomerExists,
            )

Check out the example package for a working demo.

3
likes
140
pub points
0%
popularity

Publisher

unverified uploader

Make Payments Seamless with Bani using either BaniShopperCheckout widget, or BaniShopper.checkoutModalSheet bottom sheet.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT-0 (license)

Dependencies

flutter, flutter_riverpod, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on flutter_bani_checkout