The CLI and the offline emulator
Run the sandbox on your laptop, with no account and no network.
kadai is the developer CLI. kadai emulate runs the sandbox in one process on your machine: payments, refunds, authorisations, webhook endpoints, the event explorer and the sandbox controls, on the same simulator the hosted sandbox uses, answering with the same field names. It keeps everything in memory, needs no database, and forgets everything when it stops.
kadai emulate export KADAI_BASE_URL=http://127.0.0.1:12111 export KADAI_API_KEY=sk_test_local
Point an SDK at it by its base URL. The emulator takes any key that starts sk_test_, and each key is a seller of its own, so two test suites can share one emulator without seeing each other. A live key is refused with 401.
What it answers
POST /v1/payments,GET /v1/payments/{id},GET /v1/payments,POST /v1/payments/{id}/refresh,POST /v1/payments/{id}/retryandPOST /v1/payments/{id}/refunds.POST /v1/authorisations, with/captureand/void, andGET /v1/payment_methods.POST /v1/webhook_endpointswith its test, rotate and delete routes, andGET /v1/webhook_eventswith the same filters and cursor as the hosted explorer, plus replay and the delivery log.POST /v1/sandbox/payments/{id}/settle,POST /v1/sandbox/authorisations/{id}/approve,POST /v1/sandbox/gatewayandPOST /v1/sandbox/webhook_endpoints/{id}/delay. The scenarios and amount endings are those ofGET /v1/sandbox/scenarios.
Every write needs an Idempotency-Key, and a repeated key behaves as it does on the platform. Webhooks are signed with your endpoint's secret in X-Signature, and a localhost endpoint is allowed here. Each payment's short_url opens a small page with one button per scenario, so you can click through a checkout in a browser.
What it does not answer
The orders, mandates, customers, API keys and shipments routes (/v1/orders, /v1/mandates, /v1/api_keys and the rest) answer 501 not_emulated, and so does a payment or authorisation that names an order_id or a saved instrument. There are no routing rules, risk rules or settlement dates beyond an estimate. Test those on the hosted sandbox.
The CLI against either
kadai login --key sk_test_... --base-url https://YOUR_API_HOST kadai payments create --amount 50000 --description "Two mangoes" kadai trigger PAYMENT_ID success kadai refunds create PAYMENT_ID --amount 10000 kadai events list --type payment.captured
The hosted sandbox will not deliver to a private or loopback address, so it cannot reach a server on your laptop. kadai listen --forward-to http://localhost:3000/hook asks the explorer for new events every two seconds and posts each one to your local address, signed with a secret it prints when it starts. Verify those deliveries with that secret, not your endpoint's.