Developers guide

Your first integration, step 3 of 5

Test mode

Try every flow end to end without real money.

Before you start

  • A test key (sk_test_). See API keys.

  1. Step 1.

    Tap Introduction to open the menu

    Step 1: Tap Introduction to open the menu
  2. Step 2.

    Tap Testing Guide

    Everything about testing, step by step.

    Step 2: Tap Testing Guide
  3. Step 3.

    Use a test key

    Payments made with a test key (sk_test_) never touch real money.

    Tap Test Mode Overview

    Step 3: Use a test key
  4. Step 4.

    Decide each test payment's result

    There is no real phone to approve a test payment, so you mark it complete or failed with the sandbox endpoints.

    Tap Testing M-Pesa Payments

    Step 4: Decide each test payment's result
  5. Step 5.

    Point a webhook at your test server

    The same events and webhooks fire as in live mode, so you can test success and failure before going live.

    Tap Step 2: Configure a Webhook URL (Recommended)

    Step 5: Point a webhook at your test server
  • When everything works, read Going Live and swap in a live key.

Sign in to try it in your account.

Sign in

Next in your first integration

Take payments from your app

Charge a customer by M-Pesa from your app.

Related guides