Documentation
Learn how to integrate and use Malipo to collect payments securely through M-Pesa.
Getting Started
What is Malipo?
Malipo is a payment infrastructure designed for developers and businesses that want to monetize content or services using M-Pesa. It provides a unified API for initiating STK Pushes, handling callbacks, and managing subscription paywalls.
Setup Guide
- Sign up and create your organization on the Malipo dashboard
- Obtain your Consumer Key and Consumer Secret
- Register your Callback URL
- Use your credentials to initiate a payment request
- Monitor transaction status via webhooks or dashboard
STK Push Requests
How It Works
Initiate and handle real-time M-Pesa payment prompts
Key Parameters
- •PhoneNumber – The customer’s M-Pesa number (format: 2547XXXXXXXX)
- •Amount – The amount to be charged in KES
- •AccountReference – A short label for your transaction (e.g. "Monthly Plan")
- •CallbackURL – Endpoint to receive M-Pesa transaction result
Response Structure
- •ResponseCode – 0 means success (request accepted for processing)
- •MerchantRequestID and CheckoutRequestID – Track your transaction
- •CustomerMessage – User-facing message shown on phone (e.g. "Enter your M-Pesa PIN")
Callbacks & Validation
Receiving Transaction Results
Handle confirmations and validation for your payments
Callback Payload
- •ResultCode – 0 (success), any other value means failure
- •MpesaReceiptNumber – The unique transaction ID (e.g. QER5N7R4KL)
- •TransactionDate – Timestamp of successful payment
- •Amount and PhoneNumber – Confirm payment details
Verification Tips
- •Always validate ResultCode before crediting accounts
- •Use MpesaReceiptNumber to prevent duplicate processing
Security & Authentication
Access Tokens
All API requests are authenticated using OAuth 2.0. Use your Consumer Key and Consumer Secret to generate a Bearer Token from the M-Pesa Daraja API. The token expires after one hour.
Certificate Encryption
Malipo automatically encrypts your payloads using the official M-Pesa public certificate. Always ensure you are using the correct ProductionCertificate.cer or Sandbox certificate for your environment.
Important Information
Common Errors
- •1032: Invalid credentials
- •2001: Insufficient balance
- •4005: Request timeout – retry after 5s
- •9999: Internal system error – contact support
Testing & Sandbox
Always test your integration using the M-Pesa Sandbox before moving to production. You can simulate transactions, verify callbacks, and confirm your application logic without real money transfers.