easymozpay-sdk
v1.0.7
Published
Framework-agnostic Node.js SDK for M-Pesa and e-Mola integration in Mozambique.
Maintainers
Readme
easymozpay-sdk
A powerful, framework-agnostic Node.js SDK for integrating Payment Gateways in Mozambique.
Currently Supports:
- M-Pesa (Vodacom)
- e-Mola (Movitel)
Features
- 🚀 Framework Agnostic: Works with Express, NestJS, Fastify, or vanilla Node.js.
- 🔒 Type-Safe: Written in TypeScript with full type definitions.
- 📦 Zero Coupling: This SDK is completely standalone. It connects directly to M-Pesa and e-Mola APIs. It does NOT depend on any EasyMozPay Cloud services.
Installation
npm install easymozpay-sdk axiosUsage
M-Pesa (Vodacom)
import { MpesaClient } from 'easymozpay-sdk';
const mpesa = new MpesaClient({
apiKey: 'YOUR_API_KEY',
publicKey: 'YOUR_PUBLIC_KEY',
serviceProviderCode: '171717',
environment: 'sandbox' // or 'production'
});
// C2B Payment
const response = await mpesa.c2b({
msisdn: '841234567',
amount: '100',
reference: 'T12345',
thirdPartyReference: 'ref123'
});e-Mola (Movitel)
import { EmolaClient } from 'easymozpay-sdk';
const emola = new EmolaClient({
username: 'YOUR_USERNAME',
password: 'YOUR_PASSWORD',
partnerCode: 'YOUR_PARTNER_CODE',
key: 'YOUR_PRIVATE_KEY'
});
// USSD Push Payment
const response = await emola.pushUssd({
msisdn: '861234567',
amount: '50',
transId: 'TX_001',
smsContent: 'Payment for Item X',
refNo: 'REF_001'
});Community
This SDK is free and open source. Feel free to contribute!
