Logo Lanfrica

sainingo/mpesa-connect

Domain:

digital infrastructure

Record type:

software
Creator:
sai
Host:
# MPESA Connect A powerful, developer-friendly middleware for Safaricom's MPESA payment APIs. MPESA Connect provides a simplified interface to integrate mobile payments into your applications without the complexity of dealing with the raw MPESA APIs. ## 🚀 Features - **Simplified API Integration**: Clean, RESTful endpoints for all MPESA operations - **Authentication Handling**: Automatic OAuth token management - **Comprehensive Coverage**: Support for STK Push, C2B, B2C, and more - **Robust Error Handling**: Detailed error messages and logging - **Webhook Management**: Easy configuration of callback URLs and processing - **Transaction Tracking**: Built-in transaction status tracking - **Flexible Deployment**: Use as a standalone service (middleware) ## 📦 Installation ### As a standalone service ```bash # Clone the repository git clone github.com # Install dependencies cd mpesa-connect npm install # Configure environment variables cp .env.example .env # Start the server npm start ``` ## ⚙️ Configuration Create a `.env` file with the following variables: ``` # Server Configuration PORT=3000 HOST=localhost NODE_ENV=development # MPESA API Configuration MPESA_CONSUMER_KEY=your_consumer_key MPESA_CONSUMER_SECRET=your_consumer_secret MPESA_PASSKEY=your_passkey MPESA_SHORT_CODE=your_shortcode MPESA_ENVIRONMENT=sandbox # or production # Database Configuration (if applicable) MONGODB_URI=mongodb://localhost:27017/mpesa-connect # Security JWT_SECRET=your_jwt_secret ``` ## 🔧 Usage ### As a standalone service #### STK Push ```bash curl -X POST localhost \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -d '{ "phoneNumber": "254712345678", "amount": 1, "accountReference": "Test", "transactionDesc": "Test Payment" }' ``` #### B2C Payment ```bash curl -X POST localhost \ -H 'Content-Type: application/json' \ -H 'Authorization: B …

Languages