Skip to main content

Test mode

Create a test key to try every payment flow without moving real money. Test keys use the same base URL, endpoints and response shapes as live keys.

Create a test key

In the console, open API Keys → Create new key and choose Test as the mode. Keys created in test mode start with pp_test_. Test keys count towards the limit of 10 API keys per account.

Switch a key between test and live

Open the key under API Keys → Edit and choose Live or Test. The switch applies from the next request, and the key itself stays the same, so nothing changes in your code.
  • Requests made while the key was in test mode stay simulated. That includes a payout still waiting for approval when you switch.
  • A key switched to live keeps its pp_test_ prefix. Check GET /api-key (mode, livemode) when you need to know a key’s current mode.

What’s simulated

  • STK Push, B2C payouts and wallet top-ups never reach M-Pesa. They’re accepted with status: "PROCESSING" and settle about 5 seconds later.
  • Your callback is sent when a transaction settles, in the same shape as live callbacks.
  • Test wallets start with KES 10,000 in the service wallet and KES 10,000 in the B2C wallet. Fees from your pricing plan are charged against them, payouts are taken from them, and failed transactions are refunded, just like live.
  • Payouts work before KYC is approved.
  • Transactions, balances and wallet history with a test key show only test data. Live keys never see it.
Every response and callback in test mode includes "livemode": false. Test callbacks also carry the header X-PalPluss-Livemode: false.

Choose the outcome with the phone number

Successful test transactions get a receipt starting with TEST, so it can never be mistaken for a real M-Pesa receipt.

What test keys can’t do

Payment channels and payment links are live settings. Test keys can read them, so an STK push in test mode can name a real channelId, but they can’t create, change or remove them. Those requests return 403 NOT_AVAILABLE_IN_TEST_MODE.

Going live

  1. Switch your key to live (or create a new live key) and confirm with GET /api-key that livemode is true.
  2. Make one small real payment end to end.
  3. Check your webhook handler ignores nothing it shouldn’t. Live callbacks have no livemode field.
See Going live for the full checklist.