This npm package simplifies Momo API integration for JavaScript developers in Liberia
# Momo API
This is a package to help easily integrate Momo API into your JavaScript project. It currently supports the following services:
- Collection API
- Disbursement API
- Remittance API
## Installation
To install Momo API, use npm:
```bash
npm install momo-api
```
## Avaible Module for you
```javascript
const { createApiUser } = require("momo-api")
const { createApiKey } = require("momo-api")
const { colAccessToken } = require("momo-api")
const { requestToPay } = require("momo-api")
const { disAccessToken } = require("momo-api")
const { disburseTransfer } = require("momo-api")
const { remittAccessToken } = require("momo-api")
const { remittTransfer } = require("momo-api")
const { uuidv4 } = require("momo-api");
```
## Usage
To use Momo API in your project you first have to create a Api User, ApiKey and require the product.
We use Express.js for this tutorial but feel free to use what ever framework that pleases you,
also our product for this tutorial is Collection
Import the required modules from express and momo-api.
```javascript
require('dotenv').config();
const express = require("express");
const { createApiUser } = require("momo-api")
const { createApiKey } = require("momo-api")
//Product Details here
const { colAccessToken } = require("momo-api")
const { requestToPay } = require("momo-api")
```
Create an instance of Express and assign it to the app variable.
```javascript
const app = express();
app.use(express.json());
```
Define some constants that are required to create an API user and an API key. In this case, the `xReferenceId` is a unique identifier for the transaction, the `subscriptionKey` is a subscription key provided by the API provider, the `targetEnvironment` is the environment (either sandbox or production), and the `providerCallbackHost` is the URL that the provider will send callbacks to.
```javascript
const xReferenceId = uuidv4();
const subscriptionKey = process.env.COLLECTION_SUBCRIPTION_KEY;
const targetEnvironment = "sandb …