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

# Environments

> Configure the environment to use for the PayNext SDK checkout form.

## Supported Environments

The PayNext SDK supports different environments for development, testing, and production use:

`sandbox`\
`production`

## Environment Configuration

Configure your environment when initializing the PayNext SDK:

<Note>
  Set the `environment` property on the object you pass into `checkout.mount('element-id', { ...config })` after creating the instance with `new PayNextCheckout()`, following [Mount the Checkout](/sdk-reference/introduction/getting-started#mount-the-checkout).
</Note>

```typescript custom component theme={"system"}
import { type PayNextConfig } from '@paynext/sdk'

const sandboxConfig: PayNextConfig = {
  environment: 'sandbox',
  /* other options */
}

// When mounting (see Getting Started "Mount the Checkout" section):
// const checkout = new PayNextCheckout()
// await checkout.mount('checkout-container', sandboxConfig)
```

<Note>
  Refer to [Mount the Checkout](/sdk-reference/introduction/getting-started#mount-the-checkout) for the complete mounting flow.
</Note>

## Environment Details

<AccordionGroup>
  <Accordion title="Sandbox" icon="flask">
    Testing environment that mimics production behavior without processing real payments.

    **Characteristics:**

    * Realistic payment flows
    * Test card numbers supported
    * Full API feature parity
    * Safe for integration testing
    * No actual charges

    **Use cases:**

    * Integration testing
    * QA validation
    * Demo environments
    * Client presentations
    * Pre-production testing

    ```typescript sandbox-config component theme={"system"}
    import { type PayNextConfig } from '@paynext/sdk'

    const sandboxConfig: PayNextConfig = {
      environment: 'sandbox',
      clientToken: 'sandbox_client_token_here',
      /* other options */
    }

    // When mounting (see Getting Started "Mount the Checkout" section):
    // const checkout = new PayNextCheckout()
    // await checkout.mount('checkout-container', sandboxConfig)
    ```

    <Note>
      Refer to [Mount the Checkout](/sdk-reference/introduction/getting-started#mount-the-checkout) for the complete mounting flow.
    </Note>

    <Info>
      Sandbox is the recommended environment for testing and development.
    </Info>
  </Accordion>

  <Accordion title="Production" icon="server">
    Live production environment that processes real payments with actual money.

    **Characteristics:**

    * Real payment processing
    * Live card transactions
    * Production security standards
    * Actual money movement
    * Full compliance requirements

    **Use cases:**

    * Live customer transactions
    * Production applications
    * Real e-commerce
    * Revenue generation

    ```typescript production-config component theme={"system"}
    import { type PayNextConfig } from '@paynext/sdk'

    const productionConfig: PayNextConfig = {
      environment: 'production',
      clientToken: 'live_client_token_here',
      /* other options */
    }

    // When mounting (see Getting Started "Mount the Checkout" section):
    // const checkout = new PayNextCheckout()
    // await checkout.mount('checkout-container', productionConfig)
    ```

    <Note>
      Refer to [Mount the Checkout](/sdk-reference/introduction/getting-started#mount-the-checkout) for the complete mounting flow.
    </Note>

    <Warning>
      Production environment processes real payments. Ensure thorough testing in sandbox first.
    </Warning>
  </Accordion>
</AccordionGroup>

### Production Considerations

<Warning>
  Never use test card numbers in a production environment. Only real payment methods work in production.
</Warning>

## Environment URLs

Each environment connects to different API endpoints:

<CardGroup cols={1}>
  <Card title="Sandbox" icon="flask">
    **API Endpoint:** `api-sandbox.paynext.com`\
    **Dashboard:** `sandbox-dashboard.paynext.com`
  </Card>

  <Card title="Production" icon="globe">
    **API Endpoint:** `api.paynext.com`\
    **Dashboard:** `dashboard.paynext.com`
  </Card>
</CardGroup>

## Environment Security

Different API keys are required for each environment:

```typescript api-keys component theme={"system"}
// Server-side secret keys (never expose to client)
const secretKeys = {
  sandbox: 'edccag94-8fa4-44ft-ft03-fdd818d23c05',
  production: 'idhhyf83-9go7-77gr-gr70-crr646f67e69'
}
```

<Info>
  Client tokens are safe to use in frontend code. Secret keys must only be used server-side.
</Info>

## Environment Migration Checklist

<Tabs>
  <Tab title="Sandbox → Production">
    * Update the environment to `production`
    * Replace the sandbox client token with production
    * Remove test card usage
    * Configure production webhooks
    * Set up production monitoring
    * Verify merchant account settings
    * Conduct final testing with small amounts
    * Monitor initial production transactions
  </Tab>
</Tabs>

<Tip>
  Use environment-specific domains and subdomains to clearly distinguish between environments and prevent accidental cross-environment usage.
</Tip>
