McTaba Labs logo
Software EngineeringThe WhiteboardProjectsEventsMasterclassesWebinarsLearn
Book Call

500+ developers already in the community

Get answers, find accountability partners, and stay ahead

Join Discord →
McTaba Labs logo

Educating 1 million students in tech by 2030.

Programs

  • HighSchool Graduates Launchpad
  • AI & Business Automation
  • Corporate Training
  • McTaba Story & Mission
  • Full-Stack Curriculum
  • Course Pricing & Plans
  • Frequently Asked Questions

Resources

  • Join Discord Community
  • Tech Events in Nairobi
  • Masterclasses
  • Free Resources
  • Learn
  • Campus
  • Africa Tech Talent Report
  • Partner With Us
  • Start a Project
  • Our Work

Contact Us

  • 124 Manyani East Road, Lavington, Nairobi
  • +254727795603
  • Book a Discovery Call

Office Hours:

Mon-Fri: 9am - 2pm EAT

Sat: 10am - 12pm EAT

© 2027 McTaba Labs - A product of Edtech Industries. All rights reserved.

Privacy PolicyTerms of ServiceRefund Policy
  1. Learn
  2. Learn to Code in Rwanda
  3. How to Test MoMo Payments in Sandbox Before Going Live
Bonaventure OgetoBy Bonaventure Ogeto|Updated June 3, 2026

How to Test MoMo Payments in Sandbox Before Going Live

To test MoMo payments in sandbox: (1) set up your sandbox credentials on the MoMo Developer Portal, (2) test the happy path (successful payment end-to-end), (3) test failure scenarios (insufficient funds, timeout, invalid number), (4) test callback handling (verify your server receives and processes callbacks correctly), (5) test status polling as a callback fallback, (6) test concurrent transactions, (7) test edge cases (duplicate requests, very small/large amounts). Only apply for production credentials when all scenarios pass consistently.

In this article

  1. 1. Why Thorough Sandbox Testing Matters
  2. 2. The Complete Testing Checklist
  3. 3. When You Are Ready for Production

Why Thorough Sandbox Testing Matters

Payment integrations handle real money. A bug in your MoMo integration does not just cause an error message. It can mean: a customer pays and your system does not register it (you owe them a product or a refund), your system registers a payment that never happened (you ship a product without being paid), or a customer gets charged twice (the worst outcome).

The sandbox exists to prevent all of this. It simulates the full MoMo payment flow without moving real money. Every scenario you can encounter in production can be tested in sandbox first. The time you invest in thorough sandbox testing pays back in avoided production incidents.

The Complete Testing Checklist

1. Happy path (successful payment)

  • Send a Request to Pay with valid parameters.
  • Verify you receive a 202 Accepted response.
  • Verify your callback endpoint receives the success notification.
  • Verify your application correctly updates the order status to "paid."
  • Verify the customer-facing UI shows the confirmation.

2. Failure scenarios

  • Insufficient funds: Test with a phone number that simulates insufficient balance. Verify your application shows a clear, friendly error message.
  • Timeout: Simulate a transaction where the customer does not confirm. Verify your application handles the timeout gracefully and offers a retry.
  • Invalid phone number: Send a request with a malformed or non-existent phone number. Verify the error is caught and displayed appropriately.
  • Network error: Temporarily disconnect your server from the internet during a request. Verify your error handling catches the network failure.

3. Callback reliability

  • Verify callbacks arrive consistently for successful transactions.
  • Simulate a callback failure (stop your server briefly, then restart). Verify your status polling fallback catches the missed callback.
  • Verify your server responds with 200 OK to callbacks. If it does not, MoMo may not retry.
  • Test with ngrok or your staging server to ensure callbacks work from outside your local network.

4. Edge cases

  • Duplicate requests: Send the same payment request twice (same external ID). Verify your system handles the duplicate gracefully (idempotency).
  • Very small amounts: Test with the minimum allowed amount.
  • Very large amounts: Test near the maximum transaction limit.
  • Concurrent transactions: Send multiple payment requests simultaneously. Verify each is tracked independently.
  • Special characters: Test with transaction notes that include special characters or long strings.

5. Status polling

  • Poll the transaction status endpoint using the reference ID.
  • Verify the status matches what the callback reported.
  • Verify polling works as a standalone mechanism (if the callback never arrives).

Get weekly developer tips

Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.

No spam. Unsubscribe anytime.

When You Are Ready for Production

Apply for production credentials when:

  • Every item on the testing checklist passes consistently (not just once, but repeatedly).
  • Your error handling covers every failure mode you tested.
  • Your callback handler and status polling fallback both work reliably.
  • Your logging captures enough detail to debug production issues.
  • You have environment-based configuration (environment variables for API keys, base URLs, and callback URLs) so switching from sandbox to production is a configuration change, not a code change.

After going live, run the first few production transactions with small amounts. Monitor your logs closely. Verify that production callbacks arrive, that orders are processed correctly, and that the customer experience is smooth. Only increase traffic after confirming everything works with real money.

For a structured approach to going from sandbox to production with confidence, the Deployment and Going Live course (KES 4,999, approximately RWF 50,000) covers environment management, production checklists, monitoring, and the specific considerations for payment-handling applications.

Key Takeaways

  • ✓The sandbox is free and safe. Use it extensively before touching production. There is no cost to testing, and every bug you catch in sandbox is a bug that does not lose real money in production.
  • ✓Test failure scenarios as thoroughly as success scenarios. Insufficient funds, timeout, wrong PIN, network errors: your application must handle all of these gracefully.
  • ✓Callback reliability is the most critical thing to test. Simulate callback failures and verify that your status polling fallback catches missed callbacks.
  • ✓Test with realistic data. Use proper Rwandan phone number formats and RWF amounts that match your actual use case.
  • ✓Keep a testing checklist. Run through every scenario before each production deployment, not just the first time.

Frequently Asked Questions

Does the MoMo sandbox cost anything?
No. The sandbox is free to use. You can make unlimited test API calls without any charges. This is why there is no excuse for not testing thoroughly before going live.
Can I test MoMo sandbox on my phone?
The sandbox simulates phone interactions programmatically. No actual USSD prompt appears on any real phone during sandbox testing. The sandbox automatically simulates the customer confirming or declining the payment based on the test configuration.
How do I simulate different error scenarios in sandbox?
The MoMo sandbox may support special test phone numbers or parameters that trigger specific responses (success, failure, timeout). Check the sandbox documentation for supported test scenarios. If specific failure simulation is not supported, you can test your error handling by sending malformed requests.

Start learning for free

Create a free McTaba Academy account. Access starter lessons, join the community, and explore at your own pace.

Create Free Account

Keep reading

How to Integrate MTN MoMo API in Rwanda: A Developer's Guide

The practical guide to integrating MTN MoMo API for Rwandan developers. How the API works, how to get sandbox access, how to handle collections and disbursements, and the common pitfalls that waste developers days.

Read more

MTN Mobile Money API Tutorial for Beginners (Rwanda, 2027)

A beginner-friendly walkthrough of the MTN MoMo API. From creating your developer account to processing your first test payment, with explanations at every step for developers who have never worked with a payment API before.

Read more

Common MTN MoMo API Errors and How to Fix Them

Every MoMo API error you will encounter during integration, why it happens, and how to fix it. From authentication failures to callback issues to production problems. Save this as a reference.

Read more

How to Build an E-Commerce Checkout With MoMo in Rwanda

A practical guide to building an e-commerce checkout that accepts MTN MoMo payments in Rwanda. From cart to payment confirmation, including the waiting state, callback handling, and the user experience patterns that prevent abandoned checkouts.

Read more

Why Western Payment Tutorials Fail in Rwanda (and What to Learn Instead)

You followed a Stripe tutorial on Udemy. It worked perfectly. Then a Rwandan client asked you to add MoMo payments and you realized nothing you learned applies. This article explains why, and what to learn instead.

Read more

Explore related topics

African Tech Ecosystem

Guides, salary data, and resources for developers building products in the African tech ecosystem.

Breaking Into Tech

Practical, no-nonsense guides for anyone looking to start or change their career in tech. From choosing your first language to acing interviews.

Learning to Code

Roadmaps, language guides, and practical advice for learning to code and launching a programming career.

Bonaventure Ogeto

Bonaventure Ogeto

Founder, McTaba Labs

Bonaventure is the founder of McTaba Labs, a coding bootcamp in Nairobi, Kenya. He has spent years building products for the African market and mentoring the next generation of developers across the continent.