Sandbox & Testing Guide

Use our sandbox environment to safely build and test your integration before going live.

Production vs. Sandbox

The CashPay platform provides two distinct environments:

  • Production: The live environment that processes real money transactions. All API examples in our main documentation point to production URLs like api.cashpay-all.com.
  • Sandbox: A complete testing environment that mirrors our live APIs. It allows you to build and test your integration without affecting live data or using real money.

Quick Testing in Your Browser

For quick checks and debugging, especially for `GET` endpoints, you can make requests directly in your web browser by passing your API key as a query parameter.

Example: Checking Your Test Balance in the Browser

cURL
# Copy and paste this URL into your browser, replacing with your actual Test API Key:
https://api.cashpay-all.com/api/b2b/account/balance?apiKey=CP-TEST-xxxxxxxxxxxx

If your key is correct, you will see a JSON response with your test balances. If you see a `401` or `403` error, please check that your key is correct and that your partner account is properly linked. For more details, see the Error Handling guide.

Using the Sandbox in Your Code

To use the sandbox in your code, you must use your **Test API Keys**. Production keys will not work in the sandbox, and vice-versa. You can find your test keys in your API Keys dashboard.

While we recommend using the production URL (`api.cashpay-all.com`) and simply swapping keys, you can also use the dedicated test endpoint if needed.

Test Data & Magic Values

To trigger specific scenarios like successful payments, insufficient funds, or other errors, use the following "magic" values in your sandbox requests.

Card Payments

Use any valid expiry date in the future and any 3-digit CVV. The card number determines the outcome.

Test Card Numbers

JSON
{
  "SUCCESS": "4242 4242 4242 4242",
  "DECLINED_INSUFFICIENT_FUNDS": "4000 0000 0000 0001",
  "DECLINED_INVALID_CVV": "4000 0000 0000 0002",
  "DECLINED_PROCESSING_ERROR": "4000 0000 0000 0003"
}

Mobile Money Payments

The last digit of the phone number determines the simulated outcome.

Test Phone Numbers (e.g., 24381234567X)

JSON
{
  "...1": "SUCCESS",
  "...2": "FAILURE (Timeout)",
  "...3": "FAILURE (User Cancelled)",
  "...4": "FAILURE (Insufficient Funds)"
}

Fleet Account Balance

Your sandbox fleet account is completely separate from your live account. You can add fictitious funds to your test balances directly from your Sandbox dashboard.