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

# Testing & Going Live

> Understand sandbox vs production environments and how to launch.

Orchestra uses the same API for both testing and production. The environment is determined by your credentials, not the API endpoint.

## Sandbox vs Production

| Environment | Use Case                    | Behavior                                       |
| ----------- | --------------------------- | ---------------------------------------------- |
| Sandbox     | Development, testing, CI/CD | Transactions simulated via provider test modes |
| Production  | Live customer transactions  | Real money moves                               |

<Note>
  The API base URL is the same for both environments: <code>[https://api.orchestrasolutions.com](https://api.orchestrasolutions.com)</code>
</Note>

## How Environments Work

Orchestra doesn't have a global "test mode" switch. Instead, the environment is determined by:

1. **Your Payment Gateway Account credentials** - Test credentials (e.g., Stripe's `sk_test_...`) route to sandbox; live credentials route to production
2. **The `mode` parameter** (Payments Library only) - Set to `TEST` or `LIVE` when creating sessions

This means you can run both environments simultaneously by using different Payment Gateway Account names in your API calls.

## Setting Up for Testing

### Quick Start with Mock PSPs

For immediate testing without external provider accounts, use Orchestra's built-in mock payment gateways:

1. In the Portal, go to **[Payment Gateway Account > Create](https://portal.orchestrasolutions.com/#/resource/paymentGateway/create)**
2. Select **NULLSuccess** or **NULLFailure** as the gateway
3. Give it a name (e.g., "testSuccess")
4. Leave credentials empty
5. Use the account name in your API calls

Mock PSPs simulate basic success/failure scenarios instantly, with no external dependencies. See [Mock PSPs](/guides/utilities/mock-psps) for complete details and limitations.

### 1. Create Test Payment Gateway Accounts

For comprehensive testing with real provider features, use your provider's test/sandbox credentials:

```
Name: stripeTest
Gateway: Stripe
Credentials: sk_test_...
```

### 2. Use Test API Keys

Create separate API keys for development. Label them clearly (e.g., "Development", "CI/CD").

<Warning>
  Never use production API keys in development environments or commit them to version control.
</Warning>

### 3. Use Test Card Numbers

Each payment provider has test card numbers that simulate various scenarios:

| Provider | Test Card          | Notes             |
| -------- | ------------------ | ----------------- |
| Stripe   | `4111111111111111` | Successful charge |
| Stripe   | `4000000000000002` | Card declined     |
| Adyen    | `4111111111111111` | Successful charge |

<Note>
  Check your payment provider's documentation for their full list of test cards and scenario simulations (3DS challenges, insufficient funds, etc.).
</Note>

## Payments Library Mode

When using the Payments Library, set the `mode` parameter in your session request:

```json theme={null}
{
  "operation": "CHARGE",
  "mode": "TEST",
  "amount": 25.00,
  "currencyCode": "USD",
  "paymentGatewayAccountId": "stripeTest"
}
```

| Mode   | Behavior                |
| ------ | ----------------------- |
| `TEST` | Sandbox transactions    |
| `LIVE` | Production transactions |

## Going Live Checklist

When you're ready to accept real payments:

<Steps>
  <Step title="Create Production Payment Gateway Accounts">
    Add your payment providers with live/production credentials:

    ```
    Name: stripeProduction
    Gateway: Stripe
    Credentials: sk_live_...
    ```
  </Step>

  <Step title="Generate Production API Keys">
    Create new API keys specifically for production. Use environment variables or a secrets manager.
  </Step>

  <Step title="Update Your Application">
    Change your code to reference production account names:

    ```javascript theme={null}
    // Development
    paymentGatewayAccountName: 'stripeTest'

    // Production
    paymentGatewayAccountName: 'stripeProduction'
    ```

    For the Payments Library, change `mode` from `TEST` to `LIVE`.
  </Step>

  <Step title="Test with Small Amounts">
    Before full launch, process a few small real transactions to verify everything works end-to-end.
  </Step>
</Steps>

## Running Both Environments

You can maintain both sandbox and production in the same Orchestra account:

```javascript theme={null}
// Use environment variables to switch
const accountName = process.env.NODE_ENV === 'production'
  ? 'stripeProduction'
  : 'stripeTest';

const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/charge', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': process.env.ORCHESTRA_API_KEY
  },
  body: JSON.stringify({
    amount: 25.00,
    currency: 'USD',
    paymentGatewayAccountName: accountName,
    card: { ... }
  })
});
```

## Best Practices

<CardGroup cols={2}>
  <Card title="Separate Everything" icon="layer-group">
    Use distinct API keys, Payment Gateway Accounts, and environment variables for each environment.
  </Card>

  <Card title="Never Mix Credentials" icon="triangle-exclamation">
    Don't use test credentials in production or vice versa. Label accounts clearly.
  </Card>

  <Card title="Automate Safely" icon="robot">
    CI/CD pipelines should only have access to test credentials. Production deploys should pull from secure secrets.
  </Card>

  <Card title="Monitor After Launch" icon="chart-line">
    Watch your first production transactions closely. Verify amounts, success rates, and provider responses.
  </Card>
</CardGroup>

## Related

<CardGroup cols={2}>
  <Card title="Create Account" icon="user-plus" href="/getting-started/create-account">
    Sign up for Orchestra
  </Card>

  <Card title="Add Payment Provider" icon="building-columns" href="/getting-started/add-payment-provider">
    Connect your gateways
  </Card>

  <Card title="Generate API Key" icon="key" href="/getting-started/generate-api-key">
    Create API credentials
  </Card>

  <Card title="API Reference" icon="lock" href="/api-reference/overview">
    Authentication and endpoints
  </Card>
</CardGroup>
