title: Environments

description: Understand sandbox and production environments and how to switch between them.

Environments

Wontopos provides two environments for development and production use.


Sandbox vs. Production

Start in sandbox

Use the sandbox environment for development and testing. No real data is affected.
SandboxProduction
Base URLhttps://sandbox.wontopos.comhttps://api.wontopos.com
API Key prefixsk_test_sk_live_
Rate limits100 req/min1,000 req/min
DataTest data onlyLive data
WebhooksSimulated eventsReal events
BillingNo chargesMetered billing
SLABest effort99.9% uptime

Base URLs

All API requests are scoped to one of these base URLs.

https://sandbox.wontopos.com/v1
https://api.wontopos.com/v1
GET /v1/health

Environment variables

Configure your environment via variables or SDK options.

WONTOPOS_API_KEY=sk_test_your_key_here
WONTOPOS_BASE_URL=https://sandbox.wontopos.com
WONTOPOS_ENV=sandbox
WONTOPOS_API_KEY=sk_live_your_key_here
WONTOPOS_BASE_URL=https://api.wontopos.com
WONTOPOS_ENV=production

Switching environments

Switch by changing the API key and base URL. The SDK auto-detects based on key prefix.

Update your API key

Replace the sk_test_ key with your sk_live_ key.

export WONTOPOS_API_KEY="sk_live_your_production_key"

Set the base URL

Point to the production API.

export WONTOPOS_BASE_URL="https://api.wontopos.com"

Verify the switch

Confirm you are hitting the correct environment.

curl $WONTOPOS_BASE_URL/v1/health 
  -H "Authorization: Bearer $WONTOPOS_API_KEY"

Expected response:

{
  "status": "ok",
  "environment": "production"
}

SDK configuration

Pass the environment directly in code.

// JavaScript
import Wontopos from "@wontopos/sdk";

// Sandbox
const sandbox = new Wontopos(process.env.WONTOPOS_API_KEY, {
  baseUrl: "https://sandbox.wontopos.com",
});

// Production
const production = new Wontopos(process.env.WONTOPOS_API_KEY, {
  baseUrl: "https://api.wontopos.com",
});
# Python
import wontopos

# Sandbox
sandbox = wontopos.Client(
    api_key="sk_test_...",
    base_url="https://sandbox.wontopos.com",
)

# Production
production = wontopos.Client(
    api_key="sk_live_...",
    base_url="https://api.wontopos.com",
)
// Go
// Sandbox
sandbox := wontopos.NewClient(
    "sk_test_...",
    wontopos.WithBaseURL("https://sandbox.wontopos.com"),
)

// Production
production := wontopos.NewClient(
    "sk_live_...",
    wontopos.WithBaseURL("https://api.wontopos.com"),
)

Do not mix keys and environments

A sandbox key will return `401 Unauthorized` against the production URL, and vice versa.

Next steps