Node.js library for the MVola API

Overview

MVola Node.js Library

Version Documentation Maintenance License: MIT

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;0343500003",
    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.sendPayment(tx);
  console.log(response);
}

main();

Author

👤 Tsiry Sandratraina [email protected]

🤝 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.

You might also like...

Node.js library for creating bots and sending/receiving messages using the Whatsapp Cloud API

whatsapp-cloud-api whatsapp-cloud-api is a Node.js library for creating bots and sending/receiving messages using the Whatsapp Cloud API. Contains bui

Jan 2, 2023

A unofficial Node.js library for HoYoWiki API, can get the details of Genshin Impact items!

HoYoWiki API (Node.js Library) English | 繁體中文 | 简体中文 A unofficial Node.js library for HoYoWiki API, can get the details of Genshin Impact items! Repor

Jul 17, 2022

Lightweight universal Cloudflare API client library for Node.js, Browser, and CF Workers

Cloudflare API Client Lightweight universal HTTP client for Cloudflare API based on Fetch API that works in Node.js, browser, and CF Workers environme

Nov 13, 2022

Node.js library for the Modern Treasury API.

ModernTreasury Node API Library The ModernTreasury Node library provides convenient access to the ModernTreasury REST API from applications written in

Nov 4, 2022

WPPConnect/WA-JS API SERVER is a small api server to provide url preview for @wppconnect/wa-js library

WPPConnect/WA-JS API SERVER WPPConnect/WA-JS API SERVER is a small api server to provide url preview for @wppconnect/wa-js library Our online channels

Aug 11, 2022

A JavaScript library built on top of the Faker.JS library. It generates massive amounts of fake data in the browser and node.js.

Blaver - generate massive amounts of fake data in the browser and node.js Blaver is a JavaScript library built on top of the Faker.JS library. It gene

Dec 30, 2022

Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

May 17, 2022

Inter Process Communication Module for node supporting Unix sockets, TCP, TLS, and UDP. Giving lightning speed on Linux, Mac, and Windows. Neural Networking in Node.JS

Inter Process Communication Module for node supporting Unix sockets, TCP, TLS, and UDP. Giving lightning speed on Linux, Mac, and Windows. Neural Networking in Node.JS

Inter Process Communication Module for node supporting Unix sockets, TCP, TLS, and UDP. Giving lightning speed on Linux, Mac, and Windows. Neural Networking in Node.JS

Dec 9, 2022

Node js package makes creating node jd dependincies files like Controllers,Entities and Repositories easier by executing a few instructions

Node js package makes creating node jd dependincies files like Controllers,Entities and Repositories easier by executing a few instructions

Nodejs Studio Node js package makes creating node js project dependincies files like Controllers,Entities and Repositories easier by executing a few i

Oct 12, 2022
Comments
  • Support ReactNative

    Support ReactNative

    Thanks for the lib 😁

    Unfortunately, it cannot be used with React Native as Buffer is not available, the following error will show:

    [ReferenceError: Property 'Buffer' doesn't exist]
    
    opened by mikaoelitiana 0
  • Production response is not parsed as object

    Production response is not parsed as object

    There are discrepancies in Mvola API response for GET Transaction Details on Sandbox vs Production.

    Production response has trailing comma (c.f screenshot below), causing failure of JSON response parse. This cause the result to be returned as string instead of object.

    Screenshot 2022-08-06 at 20 12 11

    Sandbox does not have this trailing comma so the response is parsed as expected.

    Screenshot 2022-08-06 at 20 28 46
    opened by mikaoelitiana 1
Releases(v1.2.0)
Owner
Tsiry Sandratraina
Software Engineer, enjoy using Go and always keen to learn new things.
Tsiry Sandratraina
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.

Eduardo Dantas 7 Jul 19, 2022
Node 18's node:test, as a node module

node-core-test This is a user-land port of node:test, the experimental test runner introduced in Node.js 18. This module makes it available in Node.js

Julian Gruber 62 Dec 15, 2022
Apilytics for Node.js - Easy API analytics for Node backends

apilytics-node Apilytics is a service that lets you analyze operational, performance and security metrics from your APIs without infrastructure-level

Apilytics 9 Sep 2, 2022
Spin node create spin api for node

Links Contract api JS api @spinfi/core @spinfi/node @spinfi/node Spin node create spin api for node How to install yarn add @spinfi/node How to init i

Spin 6 Oct 18, 2022
A Weather API project inspired by The Ultimate API Challenge / Weather API.

Weather API Project A Weather API project inspired by The Ultimate API Challenge / Weather API. Tech Stack: React.js Tailwind Axios Inspiration The Pr

Franziska 1 Dec 29, 2021
This project is built with JavaScript, Webpack, HTML & CSS, Leaderboard api. When user clicks on Refresh button it hits the api and responds with the data, The user can also post data to the api

leaderboad Description the project. this project is about the leaderboad i did during Microverse to build a website for adding Data to the API and fet

Emmanuel Moombe 4 May 30, 2022
Node.js library for the Lithic API.

Lithic Node API Library [beta] The Lithic Node library provides convenient access to the Lithic REST API from applications written in server-side Java

Lithic 38 Nov 27, 2022
Official Node.js client library for Devzat plugin API

Devzat plugin API client for Node.js This NPM package allows you to build Devzat plugins/bots with JavaScript/TypeScript. See example/index.ts for a f

Benjamin Smith 2 Apr 26, 2022