Sandbox
Test checkouts, webhooks and benefits end to end without moving real money.
Sandbox is a setting on an organization, not a separate server. A sandbox organization uses the same API, the same URLs and the same dashboard as production, but every payment is simulated. New organizations start in sandbox; switch in Settings → Environment.
Test phone numbers
Use these as customer.phone on a sandbox checkout:
| Phone | Result |
|---|---|
251900000001 | Pays instantly. The order is created, benefits are granted and webhooks fire. |
251900000002 | Fails instantly. The session expires and no order is created. |
| Any other number | checkoutUrl opens a simulator page with Approve payment, Fail payment and Cancel and go back. |
The simulator drives the same order logic as a real payment notification. Approving twice still creates exactly one order.
What changes in sandbox
| Surface | In a sandbox organization |
|---|---|
| Checkout | Always returns mode: "redirect". With a gateway, checkoutUrl goes to the simulator, never to a real gateway. Without one, it's a payment link; the phone the buyer enters there picks the outcome the same way. |
| Orders and sessions | Stamped environment: "sandbox" when created. Switching the organization later doesn't relabel them. |
| Earnings | Shown on the Overview, but can't be withdrawn and never mix with production numbers. GET /balance returns eligible: false. |
| API tokens | Issued as jamidev_test_…. |
| Webhooks | Delivered normally, with "livemode": false. |
| Emails | Buyer receipts are suppressed. You, the owner, get a [TEST]-prefixed sale email. |
| Subscriptions | No wallet money moves and no KYC is checked, so you can subscribe to your own plan. Run renewals on demand with simulateRenewal. |
Switching environments
You can switch either way at any time, per organization. Only checkout sessions created after the switch are affected.
- Sandbox → production. New checkouts charge real money. Existing test data stays labeled sandbox.
- Production → sandbox. New checkouts on your live links become simulated, and buyers aren't charged. Production history is untouched.
Tokens are tied to an environment
A token keeps the environment it was created in. After a switch it returns 401 with a
message telling you to create a new token, so a leftover test token can never touch live
data. The SDK sets JamiAuthError.hint when this happens.
Testing webhooks locally
Your laptop isn't reachable from the internet, so for local work either:
- tunnel a public URL to your machine (for example
cloudflared tunnel --url http://localhost:3000) and register it under Automation → Webhooks in the sandbox organization, or - generate signed events yourself with
jami_create_test_webhookfrom the MCP server, which can POST them straight tohttp://localhost:….
