DOCS Live

The basics

Test mode

Build and test your whole integration against test keys, with fixed inputs that give each outcome on purpose.

Every account has a test mode and a live mode. A test key works against the same base URL as a live one, but only ever touches test objects and simulated providers: no real money moves and no real customer is read. Test mode is deterministic: the same inputs give the same outcome, so your automated tests do not depend on a provider's sandbox being up.

Before you start

A test-mode key (from your onboarding or the partner portal). Test and live objects never mix: a test key cannot read or change a live payment, and the other way round.

The flow at a glance

#WhoWhat happens
1Your systemCalls the API with a test key and a test input chosen for the outcome you want.
2KulPaySimulates the provider and gives that outcome, with the same events and webhooks as live.
3Your teamMoves to a live key once every outcome is handled.

1. Charge a test number

Your system.

POST /charges · API reference

Each test phone number gives one outcome. For M-Pesa:

e-Mola, cards and the other methods have their own test inputs, listed in the integration guide. Send the X-Mock-Scenario header to force any outcome on any input.

Request

{
  "payment_id": "test-0001",
  "money": {
    "amount": "100.00",
    "currency": "MZN"
  },
  "source": {
    "type": "mobile_wallet",
    "mobile_wallet": {
      "network": "mpesa",
      "phone_number": "+258840000003"
    }
  },
  "country": "MZ"
}

2. Use the test references

Your system, for cash deposits and transfers.

With a test key, deposit lookups answer three fixed references and never real customers: 841000001 (found, "Cliente S."), 841000410 (closed) and anything else (not found). See Cash deposit to a KulPay account.

3. Go live

Your team.

Swap the test key for a live one. Nothing else in your calls changes. Live keys, live webhooks and live connectors are separate objects: register your live webhook endpoint and check your live key's scopes before the first live call.

Errors that matter here

Every error is application/problem+json with a stable code; branch on the code, not the message. The full list is in the error catalogue.

ErrorWhenWhat to do
403 mode_not_allowed

A key asked to act in a mode it cannot reach, for example a test key naming live mode.

Use a key of the mode you act in.

404 not_found

A test key read a live object, or the other way round.

Read with a key of the object's mode.

Testing it

Write one automated test per outcome above and run them on every change: success, each refusal, the timeout and the missing webhook.


All flows · API reference · Error catalogue