> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therius.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Therius Test and Production Environment Configuration

> Therius has two environments — sandbox and production. The API key prefix selects the environment automatically, with no extra configuration needed.

Therius routes every request to either the sandbox or the production environment based solely on the prefix of the API key you send. There is no environment flag, no separate SDK initialization option, and no configuration file to change. When you are ready to go live, you swap the key prefix and update the base URL — nothing else.

## Sandbox

The sandbox environment is a fully isolated test environment backed by a test-provider stub. No real card networks are involved, no real money moves, and no real accounts are charged. Use it freely during development and for automated testing pipelines.

| Property               | Value                               |
| ---------------------- | ----------------------------------- |
| **Base URL**           | `https://api-sandbox.therius.io/v1` |
| **Private key prefix** | `prv_sandbox_xxx`                   |
| **Public key prefix**  | `pub_sandbox_xxx`                   |
| **Charges**            | None — test stub only               |
| **Idempotency-Key**    | Optional (but build the habit now)  |

### Sandbox Test Cards

| Card number        | Result                                          |
| ------------------ | ----------------------------------------------- |
| `4111111111111111` | Always approved (Visa)                          |
| `5500005555555559` | Always approved (Mastercard)                    |
| `4000000000000002` | Always declined (do not honor)                  |
| `4000003220000000` | 3DS frictionless — approved without a challenge |
| `4000002500003155` | 3DS challenge — returns `pending_3ds`           |

Use any future expiry date, any cardholder name, and any 3-digit CVV (4 digits for Amex).

<Card icon="flask-vial" title="Full testing reference" href="/guides/testing">
  Every test card by network, decline scenarios by reason, the complete 3D Secure walkthrough, and APM sandbox responses.
</Card>

## Production

The production environment processes real payments over live card networks. Every charge is real, every refund affects real accounts, and every declined transaction is a real issuer decision.

| Property               | Value                           |
| ---------------------- | ------------------------------- |
| **Base URL**           | `https://api.therius.io/v1`     |
| **Private key prefix** | `prv_production_xxx`            |
| **Public key prefix**  | `pub_production_xxx`            |
| **Charges**            | Real — live card networks       |
| **Idempotency-Key**    | Mandatory on all mutating calls |

## Sandbox vs Production at a Glance

|                     | Sandbox                                | Production                            |
| ------------------- | -------------------------------------- | ------------------------------------- |
| **Base URL**        | `api-sandbox.therius.io/v1`            | `api.therius.io/v1`                   |
| **Key prefix**      | `prv_sandbox_` / `pub_sandbox_`        | `prv_production_` / `pub_production_` |
| **Real charges**    | No                                     | Yes                                   |
| **Idempotency-Key** | Recommended                            | Mandatory                             |
| **Test cards**      | `4111111111111111`, `4000000000000002` | Real cards only                       |

## Switching Environments

To move from sandbox to production, make two changes in your configuration:

1. Replace `prv_sandbox_...` with `prv_production_...` (and `pub_sandbox_...` with `pub_production_...`).
2. Update the base URL from `https://api-sandbox.therius.io/v1` to `https://api.therius.io/v1`.

No other code changes are required. The same request bodies, the same response shapes, and the same endpoint paths work in both environments.

<Warning>
  Before switching to production, verify that every mutating request in your code sends an `Idempotency-Key` header. In the sandbox this is optional; in production it is required to prevent duplicate charges on network retries.
</Warning>

## The `X-Environment` Header

Most API calls authenticate via a key, and the key prefix determines the environment. However, some flows — such as `GET /payment/inquiry/{id}` reached from the `pending_3ds` resume flow — may be called without a key. In those cases, pass the `X-Environment` header to tell Therius which environment to route the request to.

```bash theme={"dark"}
# Query sandbox payment status without a key
curl https://api-sandbox.therius.io/v1/payment/inquiry/QUICKSTART-001 \
  -H "X-Environment: sandbox"
```

Valid values are `sandbox` and `production`. When you include an API key, you do not need this header — the key prefix takes precedence.
