mvola
v1.2.0
Published
The MVola Node library provides convenient access to th MVola API from applications written in server-side Javascript
Downloads
7
Readme
The MVola Node library provides convenient access to the MVola API from applications written in server-side Javascript
🚚 Install
yarn add mvola
🚀 Usage
import { Client, SANDBOX_URL, TransactionRequest } from "mvola";
import { v4 } from "uuid";
async function main() {
const consumerKey = process.env.CONSUMER_KEY;
const consumerSecret = process.env.CONSUMER_SECRET;
const mvola = new Client(SANDBOX_URL);
const data = await mvola.auth.generateToken(consumerKey!, consumerSecret!);
mvola.transaction.setAccessToken(data.access_token);
mvola.transaction.setOptions({
version: "1.0",
correlationId: v4(),
userLanguage: "FR",
userAccountIdentifier: "msisdn;0343500004",
partnerName: "TestMVola",
});
const transactionRef = v4();
const tx: TransactionRequest = {
amount: 1000,
currency: "Ar",
descriptionText: "test",
requestDate: new Date().toISOString(),
debitParty: [
{
key: "msisdn",
value: "0343500003",
},
],
creditParty: [
{
key: "msisdn",
value: "0343500004",
},
],
metadata: [
{
key: "partnerName",
value: "TestMVola",
},
{
key: "fc",
value: "USD",
},
{
key: "amountFc",
value: "1",
},
],
requestingOrganisationTransactionReference: transactionRef,
originalTransactionReference: transactionRef,
};
const response = await mvola.transaction.initMerchantPayment(tx);
console.log(response);
}
main();
Author
👤 Tsiry Sandratraina [email protected]
- Twitter: @tsiry_sndr
- Github: @tsirysndr
🤝 Contributing
Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.
Show your support
Give a ⭐️ if this project helped you!
📝 License
Copyright © 2022 Tsiry Sandratraina [email protected]. This project is MIT licensed.