Skip to main content

Sandbox Environment

Cashless provides a sandbox environment for testing your integration without processing real payments.

Base URLs

EnvironmentBase URL
Livehttps://api.cashless.co.tz
Sandboxhttps://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:

  1. Ensure you have live API credentials (separate from sandbox credentials)
  2. Change the base URL from api-sandbox.cashless.co.tz to api.cashless.co.tz
  3. Or switch from cashless.api.sandbox() to cashless.api.live() in the SDK