Sandbox Environment
Cashless provides a sandbox environment for testing your integration without processing real payments.
Base URLs
| Environment | Base URL |
|---|---|
| Live | https://api.cashless.co.tz |
| Sandbox | https://api-sandbox.cashless.co.tz |
The sandbox API has identical endpoints and authentication to the live API. The only difference is the base URL.
Using the sandbox
With the Node.js SDK
import { cashless } from '@cashless/sdk';
// Sandbox
const api = cashless.api.sandbox('YOUR_KEY', 'YOUR_SECRET');
// Live (when ready for production)
const api = cashless.api.live('YOUR_KEY', 'YOUR_SECRET');
With direct HTTP requests
Simply change the base URL:
# Sandbox
curl -X POST https://api-sandbox.cashless.co.tz/api/v3/bills/create \
-H "Authorization: ApiKey YOUR_KEY:YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{"amount": 1000, "reference": "test-001"}'
# Live
curl -X POST https://api.cashless.co.tz/api/v3/bills/create \
-H "Authorization: ApiKey YOUR_KEY:YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{"amount": 1000, "reference": "order-001"}'
Switching to production
When you're ready to go live:
- Ensure you have live API credentials (separate from sandbox credentials)
- Change the base URL from
api-sandbox.cashless.co.tztoapi.cashless.co.tz - Or switch from
cashless.api.sandbox()tocashless.api.live()in the SDK