How to Integrate MALIPOPAY Into Your App in Under 30 Minutes
A step-by-step guide to getting your first mobile money payment working with the MALIPOPAY API - from signup to your first live transaction.
Prerequisites
Before you begin, you'll need a MALIPOPAY account (free to create) and a basic understanding of HTTP APIs. This guide uses JavaScript/Node.js examples, but the same concepts apply to any language.
Step 1: Get Your API Keys
After creating your account, navigate to Settings → API Keys in your dashboard. You'll see two sets of keys: a sandbox key for testing and a live key for production. Start with the sandbox.
- Copy your
MALIPOPAY_API_KEYandMALIPOPAY_SECRET_KEY - Never commit these to version control - use environment variables
- Sandbox transactions are free and don't move real money
Step 2: Initiate a Payment Request
The core of MALIPOPAY's API is the Collect endpoint. Send a POST request to initiate a mobile money STK push to your customer's phone:
POST https://api.malipopay.co.tz/v1/collect
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
The request body includes the customer's phone number, amount, currency (TZS), and a reference ID you generate. MALIPOPAY returns a transaction ID and triggers a payment prompt on the customer's phone.
Step 3: Handle the Callback
When the customer approves or rejects the payment, MALIPOPAY sends a webhook to your callback URL. Configure this URL in your dashboard under Settings → Webhooks.
Your webhook handler should verify the HMAC signature in the request header, update your order status based on the transaction result, and return a 200 response to acknowledge receipt.
Step 4: Go Live
Once you've tested the full flow in sandbox mode - successful payment, failed payment, and timeout - swap your sandbox keys for live keys and update your callback URL to your production endpoint. That's it. You're live.
- The same code works for M-Pesa, Airtel Money, and all other MNOs - no changes needed
- Channel selection is automatic based on the customer's phone number prefix
- Our support team reviews new live integrations within 24 hours to ensure everything is correctly configured
What's Next
Once your collect flow is working, consider adding disbursements (for refunds or payouts), payment links (for invoice-based billing), or exploring our TRA/EFD integration for automatic fiscal receipts. Full documentation is available at developers.malipopay.co.tz.
Ready to accept payments?
Get started with MALIPOPAY in minutes - no commitment required.