mvola 0.1.0-dev.2 mvola: ^0.1.0-dev.2 copied to clipboard
A MVola API client for dart and eventually flutter.
MVolaAPI dart package #
This is a package that can be used to interact with the [not that] brand new MVola API.
đĢ Features #
It allow you to make payments, see the status of a transaction and get the details of a previously made transaction.
đ ī¸ Getting started #
This package depends on the uuid and the http packages.
Terminal installation #
Type in the terminal :
dart pub add mvola
Pubspec installation #
Add these lines to your pubspec.yaml :
dependencies:
mvola:
More info can be found here, the official package repository for Dart and Flutter.
Usage #
Start by importing the library.
import 'package:mvola/mvola.dart';
Then create an instance of the MVolaClient
class.
var mvola = MVolaClient();
You then have to generate an access token in order to make transactions. You can store it in a variable for later use or just call the method to set it.
await mvola.generateAccessToken();
Now, you can make transactions, get the status of that transaction or get the details of a transaction.
// make a transaction
var transactionResponse = await mvola.initTransaction(
'gvola',
'0343500004',
5000,
'0343500003',
);
print(transactionResponse);
// get the status of a transaction
var transactionStatus = await mvola.getTransactionStatus(transactionResponse.serverCorrelationId, '0343500004', 'gvola');
print(transactionStatus);
// get the detail of a transaction
var transaction = await mvola.getTransactionDetail("636838929", "gvola", "0343500004");
print(transaction);
The complete example code can be found here or here.
Additional information #
âšī¸ This package is still in early stage of developpment. So please, don't hesitate to point out any issue or suggest an improvment.
Author #
đ¤ Tsierenana Botramanagna Gracy