monnify_flutter_sdk 1.1.0 copy "monnify_flutter_sdk: ^1.1.0" to clipboard
monnify_flutter_sdk: ^1.1.0 copied to clipboard

Flutter plugin for Monnify payment gateway. Supports Android and iOS.

monnify_flutter_sdk #

Flutter plugin for Monnify SDK

pub package

Getting Started #

To use this plugin, add monnify_flutter_sdk as a dependency in your pubspec.yaml file.

How to use #

This plugin exposes two APIs:

1. Initialize #

Initialize the plugin. This should be done once, preferably in the initState of your widget.

import 'package:monnify_flutter_sdk/monnify_flutter_sdk.dart';

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    MonnifyFlutterSdk.initialize(
              'YOUR_API_KEY', 
              'CONTRACTCODE', 
              ApplicationMode.TEST
    )
  }
}

2. Initialize Payment #

Create an object of the Transaction class and pass it to the initializePayment function

Future<void> initPayment() async {
    TransactionResponse transactionResponse =
          await MonnifyFlutterSdk.initializePayment(Transaction(
              2000,
              "NGN",
              "Customer Name",
              "mail.cus@tome.er",
              "PAYMENT_REF",
              "Description of payment",
              metaData: {
                "ip": "196.168.45.22",
                "device": "mobile_flutter"
                // any other info
              },
              paymentMethods: [PaymentMethod.CARD, PaymentMethod.ACCOUNT_TRANSFER],
              incomeSplitConfig: [
                SubAccountDetails("MFY_SUB_319452883968", 10.5, 500, true),
                SubAccountDetails("MFY_SUB_259811283666", 10.5, 1000, false)]
          )
    );
}

Optional params: Payment Methods specify transaction-level payment methods. Sub-Accounts in incomeSplitConfig are accounts that will receive settlement for the particular transaction being initialized. MetaData is map with single depth for any extra information you want to pass along with the transaction.

The TransactionResponse class received after sdk is closed contains the below fields

String paymentDate;
double amountPayable;
double amountPaid;
String paymentMethod;
String transactionStatus;
String transactionReference;
String paymentReference;

Need more information? #

For further info about Monnify's mobile SDKs, including transaction status types, see the documentations for the Android and iOS SDKs

12
likes
120
pub points
57%
popularity

Publisher

unverified uploader

Flutter plugin for Monnify payment gateway. Supports Android and iOS.

Homepage

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on monnify_flutter_sdk