UNPKG

mtn-momo-api

Version:

The MTN-Momo-API is an npm package that provides a convenient and simplified way to interact with the MoMo (Mobile Money) API for making financial transactions. It abstracts the complexities of the API and offers a streamlined interface for requesting pay

45 lines (39 loc) 761 B
const { Controller } = require('./momo'); // Create an async function to use await async function makeRequest({ callbackHost, userApiKey, userId, primaryKey, amount, currency, externalId, partyIdType, partyId, payerMessage, payeeNote }) { const app = new Controller({ callbackHost, userApiKey, userId, primaryKey }); try { const response = await app.requestToPay( amount, currency, externalId, partyIdType, partyId, payerMessage, payeeNote ); const status = await app.getTransactionStatus(response.referenceId); return { response, status }; } catch (error) { console.error("Error:", error); throw error; } } module.exports = { makeRequest };