How thatfiredev/mpesa-node-api works
This small Node.js library exposes configuration plus C2B and B2C payment methods. Each method initializes configuration, creates an RSA-encrypted bearer token, sends a request to the corresponding M-Pesa endpoint, and returns the response data or throws an error. The README documents environment-based and custom configuration. Both transaction methods share one implementation file; the graph shows their separate request paths without assuming any additional stages.
Main entry points: index.js C2B payment
Components 7
Other components
- API caller
- Configuration
index.js - C2B payment
index.js - B2C payment
index.js - Bearer token
index.js - Axios client
- M-Pesa API
Connections 13
- API caller → Configuration: configures API
README.md - API caller → C2B payment: initiates C2B
README.md - API caller → B2C payment: initiates B2C
README.md - C2B payment → Configuration: initializes config
index.js - B2C payment → Configuration: initializes config
index.js - C2B payment → Bearer token: creates token
index.js - B2C payment → Bearer token: creates token
index.js - C2B payment → Axios client: posts request
index.js - B2C payment → Axios client: posts request
index.js - Axios client → M-Pesa API: sends request
- M-Pesa API → Axios client: returns response
- Axios client → C2B payment: returns data
index.js - Axios client → B2C payment: returns data
index.js