Sandbox
Test money, magic phone numbers and simulated outcomes for Swichi Payments.
Every Swichi account has a sandbox from the moment it signs up: its own Swichi business, a wallet with TZS 1,000,000 of test money, and a Test Shop to transfer to. Your sandbox keys reach only the sandbox and your live keys only live: they never share an id, a key or a wallet.
Nothing real moves: collections go to made-up pushes, payouts to nobody. Webhooks really fire, signed like live ones, so you can build your whole integration here.
Magic numbers
A sandbox payment's outcome is set by how the number ends (collections: the payer's number;
payouts: the phone or account number). Use any Tanzanian mobile money prefix, for example
0754 000 001 (M-Pesa) or 0688 000 001 (Airtel Money).
| Number ends in | What happens |
|---|---|
001 | Approved (or paid out) at once |
002 | The payer declines (failure.code: payer_declined) |
003 | Not enough money (payer_insufficient_funds) |
004 | Nobody answers; the collection expires (payer_no_answer) |
005 | Waits: you decide it |
| anything else | Waits: you decide it |
Decide a payment yourself
POST /v1/sandbox/collections/{id}/simulate with {"outcome": "succeeded"}, "failed" or
"expired" settles a waiting collection as if the payer had answered;
POST /v1/sandbox/payouts/{id}/simulate with "succeeded", "failed" or "reversed" settles a
sent payout. These work with sandbox keys only (sandbox_only otherwise).
You can do the same without code on Developers → Sandbox: send a test payment, then approve, decline or expire it. Add test money tops the wallet up again.
What is the same as live
Fees, limits, idempotency, errors, receipts and webhooks behave as they do live. Two things do not: the sandbox has no merchant review (live businesses are reviewed, and new ones start with lower limits and next-day payouts), and payouts are never really sent.