Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@hachther/mesomb-browser

hachther7MIT1.1.1TypeScript support: included

JS client for browser to perform mobile payment operation with MeSomb

React, ReactNative, Angular, MeSomb, Orange Money, Mobile Money, Airtel Money

readme

Welcome to js-mesomb 👋

Version Documentation License: MIT Twitter: hachther

JavaScript client for mobile payment (Orange Money, Mobile Money ...) with MeSomb services.

You can check the full documentation of the api here

🏠 Homepage

Install

yarn add @hachther/mesomb-browser
# or
npm install @hachther/mesomb-browser

Usage

Check the full documentation here

Below some quick examples

Collect money from an account

ES6 import

import {PaymentOperation, RandomGenerator} from '@hachther/mesomb-browser';

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const response = await payment.makeCollect({amount: 100, service: 'MTN', payer: '670000000', nonce: RandomGenerator.nonce()});
console.log(response.isOperationSuccess());
console.log(response.isTransactionSuccess());

Modular include

const {PaymentOperation, RandomGenerator} = require('@hachther/mesomb-browser');

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const response = await payment.makeCollect({amount: 100, service: 'MTN', payer: '670000000', nonce: RandomGenerator.nonce()});
console.log(response.isOperationSuccess());
console.log(response.isTransactionSuccess());

Depose money in an account

ES6 import

import {PaymentOperation, RandomGenerator} from '@hachther/mesomb-browser';

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const response = await payment.makeDeposit({amount: 100, service: 'MTN', receiver: '670000000', nonce: RandomGenerator.nonce()});
console.log(response.isOperationSuccess());
console.log(response.isTransactionSuccess());

Modular include

const {PaymentOperation, RandomGenerator} = require('@hachther/mesomb-browser');

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const response = await payment.makeDeposit({amount: 100, service: 'MTN', receiver: '670000000', nonce: RandomGenerator.nonce()});
console.log(response.isOperationSuccess());
console.log(response.isTransactionSuccess());

Get application status

ES6 import

import {PaymentOperation, Signature} from '@hachther/mesomb-browser';

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const application = await payment.getStatus();
console.log(application);

Modular include

const {PaymentOperation, Signature} = require('@hachther/mesomb-browser');

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const application = await payment.getStatus();
console.log(application);

Get transactions by IDs

ES6 import

import {PaymentOperation, Signature} from '@hachther/mesomb-browser';

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const transactions = await payment.getTransactions(['ID1', 'ID2']);
console.log(transactions);

Modular include

const {PaymentOperation, Signature} = require('@hachther/mesomb-browser');

const payment = new PaymentOperation({applicationKey: '<applicationKey>', accessKey: '<AccessKey>', secretKey: '<SecretKey>'});
const transactions = await payment.getTransactions(['ID1', 'ID2']);
console.log(transactions);

Author

👤 Hachther LLC contact@hachther.com

Show your support

Give a ⭐️ if this project helped you!