Monnify Flutter SDK

 

Getting started with the Monnify Flutter SDK

 

 

 

 

The Monnify Flutter SDK allows you to accept payments from customers in your Mobile application via:

  1. Card Payment

  2. Bank Transfer

  3. USSD Payment

  4. Payment by Phone Number

Steps to Implementation

1. Add the dependency for the Monnify SDK

Add monnify_payment_sdk as a dependency in your pubspec.yaml file.

2. Initialize the plugin

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

import 'package:monnify_payment_sdk/monnify_payment_sdk.dart'; class _MyAppState extends State<MyApp> { @override void initState() { super.initState(); MonnifyPaymentSdk.initialize( 'YOUR_API_KEY', 'CONTRACTCODE', ApplicationMode.TEST ) } }

 

3. Initialize payment

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

Future<void> initPayment() async { TransactionResponse transactionResponse = await MonnifyPaymentSdk.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)] ) ); }

 

Field Reference

This shows the description for the fields in the request body

 

Field

Mandatory(M)/Optional(O)

Description

Field

Mandatory(M)/Optional(O)

Description

amount

M

The amount be paid by the customer

description

M

The description of the transaction being made

PAYMENT_REF

M

Merchant’s unique reference for every transaction

customer Name

M

This field contains the full name of the customer

Customer Email

M

Email address of the customer

API_Key

M

Merchant’s API Key

CONTRACTCODE

M

Merchant’s Contract Code