mvola 1.0.0 copy "mvola: ^1.0.0" to clipboard
mvola: ^1.0.0 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 from a Dart or Flutter client.

đŸ”Ģ 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.

Installing from the command line #

Type in the terminal :

dart pub add mvola

or, if your adding it to a flutter project :

flutter pub add mvola

Pubspec installation #

Add these lines to your pubspec.yaml :

dependencies:
    mvola:

More info can be found on pub.dev, 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 with the base url for the requests(https://devapi.mvola.mg in the sandbox and https://api.mvola.mg in production, as mentionned in the documentation) and a consumer key and a consumer secret. An optional callbackUrl can be provided, it's the url where the API send a notification whether a transaction has been successful or not.

var mvola = MVolaClient(baseUrl, consumerKey, consumerSecret);

[consumerKey] and [consumerSecret] can be found on the mvola devportal upon creating an application.

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(
    partnerName: 'name',
    partnerNumber: '0343500004',
    creditNumber: '0343500004',
    amount: 5000,
    debitNumber: '0343500003',
    description: 'short description',
);

// get the status of a transaction
var transactionStatus = await mvola.getTransactionStatus(transactionResponse.serverCorrelationId, '0343500004', 'name');

// get the detail of a transaction
var transaction = await mvola.getTransactionDetail(serverCorrelationId, "name", "0343500004");

In the development environment, only 0343500004 and 0343500003 can be used as merchant or customer numbers.

The complete example code can be found here or here.

Todo #

  • ❌ Improve documentation
  • ❌ Improve error/exception responses
  • ❌ Add badges to README.md

Support #

If you encounter any issue or want more information about this package, don't hesitate to email me or message me on facebook or open an issue.

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.

License #

MIT

Author #

👤 Tsierenana Botramanagna Gracy

✉ī¸ gtsierenana@gmail.com

5
likes
130
pub points
0%
popularity

Publisher

unverified uploader

A MVola API client for dart and eventually flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

http, uuid

More

Packages that depend on mvola