To build an e-commerce checkout with MoMo in Rwanda: (1) build your cart and checkout page, (2) at checkout, collect the customer's MoMo phone number and selected items, (3) send a Request to Pay to the MoMo Collections API, (4) show a waiting screen that tells the customer to check their phone, (5) handle the MoMo callback to confirm payment, (6) display the order confirmation and trigger fulfillment. The critical UX decision is the waiting state between payment request and confirmation, which typically takes 10 to 30 seconds.
Here is the full flow from the customer's perspective, and what your code needs to do at each step.
Step 1: Cart review. The customer reviews their items, quantities, and total. Standard e-commerce. Nothing MoMo-specific here.
Step 2: Payment method selection. The customer chooses MoMo or Airtel Money. Show both options clearly with recognizable branding. If your checkout only supports MoMo, you lose every Airtel Money customer.
Step 3: Phone number entry. The customer enters their mobile money phone number. Validate the format before proceeding. Show which provider is associated with their number prefix (078/079 for MTN, 072/073 for Airtel) as a confirmation.
Step 4: Payment initiation. Your server sends a Request to Pay to the MoMo API (or Airtel Money API). Create an order record in your database with status "pending." Return a reference ID to the front end.
Step 5: The waiting state. This is where most e-commerce checkouts built by developers unfamiliar with mobile money go wrong. The customer's browser shows a waiting screen. A clear message says: "We sent a payment request to your phone. Please check your MoMo and enter your PIN to confirm." A spinner or progress indicator shows that the process is active. The customer picks up their phone, sees the USSD prompt, and enters their PIN.
Step 6: Confirmation. Your server receives the callback from MoMo. If successful, update the order status to "confirmed." The front end polls your server (or uses WebSocket/SSE) to detect the status change and displays the confirmation page. If the callback indicates failure, display a clear error message with the option to retry.
The time between "I clicked pay" and "my payment is confirmed" is typically 10 to 30 seconds with mobile money. During this time, the customer is interacting with their phone, not your website. If your website does not communicate this clearly, the customer thinks something is broken.
Good practices for the waiting state:
The front end should poll your server every two to three seconds to check if the callback has been received. When the status changes from "pending" to "successful" or "failed," update the UI immediately. WebSockets or Server-Sent Events are more elegant than polling but add complexity. For most e-commerce sites, polling every few seconds is perfectly adequate.
Get weekly developer tips
Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.
No spam. Unsubscribe anytime.
Failure is a normal part of mobile money payments. Your checkout must handle these scenarios without confusing the customer:
Timeout: The customer did not confirm within the time limit. Message: "The payment request expired. Please try again." Show a retry button.
Insufficient funds: The customer does not have enough money in their MoMo wallet. Message: "Insufficient funds. Please top up your MoMo account and try again." Do not reveal the customer's balance.
Wrong PIN: The customer entered the wrong PIN. Message: "The payment was not authorized. Please try again and ensure you enter the correct PIN."
Network error: A communication failure between your server and the MoMo API. Message: "We could not process your payment due to a network issue. Please try again in a few minutes."
Callback not received: Your server did not receive a callback within the expected time. Use the transaction status polling endpoint as a fallback. If polling also fails, ask the customer to check their MoMo transaction history and contact support.
For the complete list of MoMo error codes and how to handle each one, see our guide to common MoMo API errors.
The minimal architecture for an e-commerce checkout with MoMo:
Critical security considerations:
This architecture is exactly what McTaba teaches. The Full-Stack course (approximately RWF 1,200,000) covers React, Node.js, PostgreSQL, and deployment. The M-Pesa Integration course (approximately RWF 100,000) adds the mobile money layer. Together, they give you everything needed to build a production checkout like this.
Create a free McTaba Academy account. Access starter lessons, join the community, and explore at your own pace.
Create Free Account