Test Environments

You can setup a sandbox to test common workflows, like payments and reporting flows.

Create a sandbox account and send an authenticated test request to start integrating with the Stax API.

This guide is for developers building integrations for partners and merchants. A sandbox is a test environment that lets you test payments and other functionality without moving real money.

1. Create a Stax sandbox account

To begin developing with Stax, create a sandbox account by clicking the appropriate button below.

Creating a Stax sandbox account will subscribe you to receive Stax emails. You can opt out at any time.


When accessing the API, you will use the same production URL (https://apiprod.fattlabs.com/) regardless of whether you use a live or sandbox API key. The sandbox is connected to a test gateway, so no real transactions will be processed.

For testing purposes, specific test card numbers are available. Refer to the Test Card Payment Methods.


2. Prepare your test request

  1. Copy your sandbox account's secret API key from Stax Pay > Apps > API Keys. Use a sandbox key because sandbox and live accounts share the same API base URL; your key determines which environment you access.
  2. Open a Bash terminal with curl installed. Run curl --version to confirm curl is available; the example requires curl 7.76.0 or later for --fail-with-body.

Keep your secret API key out of client-side code and public repositories. The example prompts for your key without displaying it or including it in the command you enter in your shell history.

3. Send an authenticated request

Run this example in Bash and paste your sandbox API key at the prompt. It sends a read-only request and prints the response body and HTTP status.

(
  # Copy your sandbox secret API key from Stax Pay > Apps > API Keys.
  if ! read -r -s -p "Stax sandbox secret API key: " STAX_API_KEY; then
    printf '\nCould not read the API key.\n' >&2
    exit 1
  fi
  printf '\n'

  if [[ -z "$STAX_API_KEY" ]]; then
    printf 'Enter a nonempty sandbox secret API key.\n' >&2
    exit 1
  fi

  if ! curl --fail-with-body --show-error \
    --request GET "https://apiprod.fattlabs.com/" \
    --header "Authorization: Bearer ${STAX_API_KEY}" \
    --header "Content-Type: application/json" \
    --write-out '\nHTTP status: %{http_code}\n'; then
    printf 'Request failed. Check the HTTP status and response above; for connection errors, check the curl error message.\n' >&2
    exit 1
  fi
)

A successful request returns 200 OK. After the response body, the example prints:

HTTP status: 200

Troubleshoot your request

  • Empty key: Run the example again and enter your sandbox secret API key at the prompt.
  • 401 Unauthorized: Copy the secret API key again from Stax Pay > Apps > API Keys and retry.
  • 429 Too Many Requests: Wait for the interval in the response's Retry-After header before retrying.
  • Connection error: Review the curl error message and check your network connection before retrying.
  • Other HTTP errors: Review the response body and the status-code guidance in the API reference.

When you receive HTTP status: 200, you have verified an authenticated connection. Continue with the API reference to test the calls your integration needs, using your sandbox key.


Did this page help you?