monnify_flutter_sdk 0.0.1-alpha02 monnify_flutter_sdk: ^0.0.1-alpha02 copied to clipboard
Flutter Plugin for Monnify SDK
monnify_flutter_sdk #
Flutter plugin for Monnify SDK
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';
import 'package:monnify_flutter_sdk/ApplicationMode.dart';
import 'package:monnify_flutter_sdk/Transaction.dart';
import 'package:monnify_flutter_sdk/TransactionResponse.dart';
import 'package:monnify_flutter_sdk/SubAccountDetails.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",
[]
)
);
}
The TransactionResponse class 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