Test mode

Build and test your integration without moving money.

Build with a test key (fpk_test_…): it works as soon as you sign up and moves no money. Switch to a live key (fpk_live_…) once your merchant is verified. The base URL, endpoints and responses are the same.

  • What you create with a test key can only be reached with a test key, and the same for live. Your test and live balances are separate.
  • livemode on every payment, webhook endpoint and event is false for test and true for live.
  • A webhook endpoint registered with a test key gets only test events.

Choose the outcome with a test number

In test mode, pick the outcome you want to test with the customer's phone number.

payment_method_data.mobile_money.phoneOutcome
255700000001Succeeds a few seconds after it is created. Any number not in this table does the same.
255700000002Fails: the customer declines. failureCode is CUSTOMER_DECLINED.
255700000003Fails: the customer's wallet is short. failureCode is INSUFFICIENT_FUNDS.
255700000004Stays pending, so you can test a payment that never settles.
255700000005Succeeds, like 255700000001.
255700000006The customer never approves the request. A collection expires after 3 minutes, so you can test payment.expired.

The same numbers work for payouts. A test payment to one of them is on the mpesa network. A live payment to a test number is refused with 400.

Go live

When your integration works in test mode:

  1. Verify your business in the dashboard, and wait for the approval email.
  2. Create a live API key. Until your business is approved, creating one is refused with 403 and the code account_not_verified.
  3. Register your webhook endpoints with the live key.
  4. Switch your server to the live key.

Go live lists the details and documents we ask for and what each review state means.

On this page