@hachther/mesomb
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

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
# or
npm install @hachther/mesomb

Usage

Check the full documentation here

Below some quick examples

Collect money from an account

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

// or Modular import
// const {PaymentOperation} = require('@hachther/mesomb');

const applicationKey = '<your application key>'
const accessKey = '<your access key>'
const secretKey = '<your secret key>'
const client = new PaymentOperation({applicationKey, accessKey, secretKey});

const response = await client.makeCollect({
  payer: '670000000',
  amount: 10000,
  service: 'MTN',
  country: 'CM',
  currency: 'XAF',
  customer: {
    email: 'email@gmail.com',
    firstName: 'Dan',
    lastName: 'Fisher',
    town: 'Douala',
    region: 'Littoral',
    country: 'CM',
    address: 'Bepanda',
  },
  location: {town: 'Douala', region: 'Littoral', country: 'CM'},
  products: [
    {name: 'Sac a Main SM', category: 'Sac a Main', quantity: 1, amount: 10000}
  ],
});

Depose money in an account

import {PaymentOperation} from '@hachther/mesomb';

// Modular import
// const {PaymentOperation} = require('@hachther/mesomb');

const applicationKey = '<your application key>'
const accessKey = '<your access key>'
const secretKey = '<your secret key>'
const client = new PaymentOperation({applicationKey, accessKey, secretKey});

const response = await client.makeDeposit({
  receiver: '670000000',
  amount: 10000,
  service: 'MTN',
  country: 'CM',
  currency: 'XAF',
  customer: {
    email: 'email@gmail.com',
    first_name: 'Dan',
    last_name: 'Fisher',
    town: 'Douala',
    region: 'Littoral',
    country: 'CM',
    address: 'Bepanda',
  },
  location: {town: 'Douala', region: 'Littoral', country: 'CM'},
  products: [
    {name: 'Sac a Main SM', category: 'Sac a Main', quantity: 1, 'amount': 10000}
  ],
});

response.isOperationSuccess()
response.isTransactionSuccess()

Get application status

import {PaymentOperation} from '@hachther/mesomb';
// Modular import
// const {PaymentOperation} = require('@hachther/mesomb');

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

Get transactions by IDs

import {PaymentOperation} from '@hachther/mesomb';
// Modular import
// const {PaymentOperation} = require('@hachther/mesomb');

const applicationKey = '<your application key>'
const accessKey = '<your access key>'
const secretKey = '<your secret key>'
const client = new PaymentOperation({applicationKey, accessKey, secretKey});

const transactions = await client.getTransactions(['a483a9e8-51d7-44c9-875b-1305b1801274']);

console.log(transactions)

Author

👤 Hachther LLC contact@hachther.com

Show your support

Give a ⭐️ if this project helped you!

Package Sidebar

Install

npm i @hachther/mesomb

Weekly Downloads

20

Version

2.0.0

License

MIT

Unpacked Size

121 kB

Total Files

60

Last publish

Collaborators

  • hachtherllc