> ## Documentation Index
> Fetch the complete documentation index at: https://docs.palpluss.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test mode

> Build and test your integration with simulated money. Same endpoints, same responses, nothing reaches M-Pesa.

# 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](https://console.palpluss.com), 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

| Phone number | Final status | `result_desc` |
| - | - | - |
| `0700000001` | `FAILED` | The balance is insufficient for the transaction. |
| `0700000002` | `CANCELLED` | Request cancelled by user. |
| `0700000003` | `FAILED` | The customer could not be reached. |
| Any other valid number | `SUCCESS` | The service request is processed successfully. |

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

```bash theme={null}
curl -X POST https://api.palpluss.com/v1/payments/stk \
  -u "$PALPLUSS_TEST_KEY:" \
  -H "Content-Type: application/json" \
  -d '{ "amount": 100, "phone": "0700000002", "callbackUrl": "https://yourapp.com/webhooks/palpluss" }'
```

## 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](https://docs.palpluss.com/guides/going-live.md) for the full checklist.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.