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

# Environments

> Use sandbox and live environments to test and deploy your Paygentic integration safely

Paygentic provides two separate environments to support your development workflow: **Sandbox** and **Live**. This allows you to test your integration thoroughly before going to production.

## Environment overview

<CardGroup cols={2}>
  <Card title="Sandbox Environment" icon="flask">
    Test your integration without affecting real data or processing actual payments
  </Card>

  <Card title="Live Environment" icon="rocket">
    Production environment for real customers and actual payment processing
  </Card>
</CardGroup>

## Sandbox environment

The sandbox environment is a complete, fully-functional replica of the live environment where you can test your integration without any risk.

### Accessing sandbox

* **Platform Dashboard**: [https://platform.sandbox.paygentic.io](https://platform.sandbox.paygentic.io)
* **API Base URL**: `https://api.sandbox.paygentic.io`

### Key features

* **Same Login Credentials**: Use the same email and password as your live environment account
* **Isolated Data**: All data is completely separated from the live environment
* **Unique IDs**: All resource IDs (customers, subscriptions, products, etc.) are unique to sandbox
* **Feature Parity**: Sandbox has complete feature parity with the live system
* **Test API Keys**: API keys are prefixed with `sk_test_` and only work in sandbox

<Note>
  While you use the same login credentials for both environments, all data, API keys, and resource IDs are completely separate between sandbox and live.
</Note>

### When to use sandbox

Use the sandbox environment to:

* Test your integration during development
* Validate new features before deploying to production
* Experiment with pricing models and configurations
* Train team members on the platform
* Debug issues without affecting real customers
* Run automated integration tests

<Warning>
  **Test Data Only**: The sandbox environment is exclusively for testing purposes. Never add real user data, personal information, or production customer data to sandbox. Always use synthetic test data only.
</Warning>

## Live environment

The live environment is your production environment where real transactions occur.

### Accessing live

* **Platform Dashboard**: [https://platform.paygentic.io](https://platform.paygentic.io)
* **API Base URL**: `https://api.paygentic.io`

### Key features

* **Production Data**: Real customers and actual payment processing
* **Live API Keys**: API keys are prefixed with `sk_live_` and only work in live
* **Real Payments**: All transactions process actual payments

## API keys and environments

API keys are environment-specific and identified by their prefix:

| Environment | API Key Prefix | Example             |
| ----------- | -------------- | ------------------- |
| Sandbox     | `sk_test_`     | `sk_test_abc123...` |
| Live        | `sk_live_`     | `sk_live_xyz789...` |

### Key restrictions

* **Sandbox keys** (`sk_test_`) can only be used with `https://api.sandbox.paygentic.io`
* **Live keys** (`sk_live_`) can only be used with `https://api.paygentic.io`
* Using a key with the wrong environment will result in authentication errors

```bash Sandbox API Request theme={null}
curl -H "Authorization: Bearer sk_test_YOUR_API_KEY" \
  https://api.sandbox.paygentic.io/v0/products
```

```bash Live API Request theme={null}
curl -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  https://api.paygentic.io/v0/products
```

## Best practices

### Development workflow

1. **Develop in Sandbox**: Build and test your integration in sandbox first
2. **Use Environment Variables**: Store API keys and base URLs in environment variables
3. **Automated Testing**: Run integration tests against sandbox in your CI/CD pipeline
4. **Validate Changes**: Test all changes in sandbox before deploying to live
5. **Monitor Both Environments**: Set up monitoring for both environments

### Security considerations

* Never commit API keys to version control
* Use separate API keys for each environment
* Rotate keys regularly in both environments
* Restrict live API keys to production servers only
* Use sandbox keys for local development and testing

## Switching between environments

To switch between environments:

1. **Update API Key**: Use the appropriate `sk_test_` or `sk_live_` key
2. **Update Base URL**: Point to the correct API endpoint
3. **Verify Environment**: Check that you're working with the intended environment before making changes

<Tip>
  Add environment indicators to your application's admin panel or logs to clearly show which environment you're working with.
</Tip>

## Data synchronization

<Warning>
  Data is **not** synchronized between sandbox and live environments. Each environment maintains its own independent database.
</Warning>

When moving from sandbox to live:

* You'll need to recreate products, plans, and pricing configurations in live
* Customer data must be created fresh in live
* Usage events and billing history are separate in each environment
* API keys and webhooks must be configured separately

<Warning>
  **Important**: Never copy real customer data or personal information from live to sandbox. Sandbox should only contain synthetic test data. Similarly, never use production customer data for testing purposes.
</Warning>

## Troubleshooting

### Wrong API key for environment

```json Error Response theme={null}
{
  "error": "Unauthorized",
  "message": "Invalid API key"
}
```

**Solution**: Verify you're using the correct API key prefix (`sk_test_` for sandbox, `sk_live_` for live) and the matching API base URL.

### Data not found in new environment

If you're switching from sandbox to live and can't find your data, remember that environments are completely isolated. You need to recreate your configuration in the new environment.

### Testing payments in sandbox

Sandbox environment uses test payment credentials that simulate real payment flows without processing actual charges. Contact [support@paygentic.io](mailto:support@paygentic.io) for test payment credentials.
