Logo Lanfrica

Nocyl/money-pulse-js

Domain:

digital infrastructure

Record type:

software
Creator:
Noc
Host:
Official Money-Pulse JavaScript/TypeScript SDK for payments and payouts across Africa # @money-pulse/checkout Official JavaScript/TypeScript SDK for Money-Pulse — Accept payments and process payouts across Africa. ## Installation ```bash npm install @money-pulse/checkout ``` ## Server-side: Create a payment ```typescript import { MoneyPulse } from '@money-pulse/checkout'; const mp = new MoneyPulse({ apiKey: process.env.MP_SECRET_KEY! }); const payment = await mp.payments.create({ amount: 10000, currency: 'XOF', country: 'CI', customer: { email: 'client@example.com', phone: '+22507000000' }, callbackUrl: 'your-site.com', returnUrl: 'your-site.com', }); console.log(payment.checkoutUrl); // Redirect customer here ``` ## Browser checkout (popup) ```html MoneyPulseCheckout.open({ publicKey: 'mp_pub_xxx', amount: 5000, currency: 'XOF', onSuccess: (r) => console.log('Paid:', r), onError: (e) => console.error(e), }); ``` ## Payouts ```typescript const payout = await mp.payouts.create({ amount: 50000, currency: 'XOF', country: 'CI', recipient: { type: 'mobile_money', phone: '+22507000000', name: 'Jean Kouassi', }, }); ``` ## Webhooks (signature verification) Money-Pulse signs every webhook with HMAC-SHA256 in the `X-MoneyPulse-Signature` header. ```typescript import crypto from 'crypto'; import express from 'express'; const app = express(); app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => { const signature = req.headers['x-moneypulse-signature'] as string; const expected = crypto .createHmac('sha256', process.env.MP_WEBHOOK_SECRET!) .update(req.body) .digest('hex'); if (signature !== expected) return res.status(401).end(); const event = JSON.parse(req.body.toString()); switch (event.type) { case 'payment.success': /* fulfill order */ break; case 'payment.failed': /* notify customer */ break; case 'payout.completed':/* mark withdrawal done */ break; } res.json({ received: true }); }); ``` ## Mode simulation (no funds, no webhook) Use `simulate: true` to run end-to-end tests …

Licenses