MVolaAPI dart package
It allow you to make payments, see the status of a transaction and get the details of a previously made transaction.
🛠️ Getting started
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
Add these lines to your pubspec.yaml :
Start by importing the library.
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);
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.
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.
ℹ️ This package is still in early stage of developpment. So please, don't hesitate to point out any issue or suggest an improvment.
👤 Tsierenana Botramanagna Gracy
- Support for doing something awesome.