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

# Environments

> Sandbox and Production environments within an instance.

Each instance has two environments.

* `production` - The environment intended for use within your live app.
* `sandbox` - The environment intended for use by developers to test
  transactions and within your test or quality assurance systems.

These two environments have separate infrastructures so resources such as buyers
and payment services are not shared between them. This also means that there are
different hostnames for `sandbox` and `production` APIs and dashboards.

The hostnames for the APIs are as follows:

| Environment  | Hostname                              |
| ------------ | ------------------------------------- |
| `sandbox`    | `api.sandbox.{instance_id}.gr4vy.app` |
| `production` | `api.{instance_id}.gr4vy.app`         |

<Note>
  The instance ID is the unique identifier for the deployment of the system and is included in every API call.
  Together with the environment (sandbox or production) it is used to connect to the right APIs, as well as dashboard.
</Note>

Test payment services, card rules, and other settings in the `sandbox`
environment, before migrating them to the `production` environment.

## Why environments?

Environments are an essential part of any development process. A developer
might run the app on their development machine, and to try and test
the integration they might want to try and create some payments. To stop the
dashboard from being populated with lots of testing data it would be best
for the developer to create their test transactions against the `sandbox`
environment instead.

Similarly, running either automated or manual tests against the
API as part of QA and testing is common. To stop this from interfering with live
environments, set these tests to run against the `sandbox` environment.

## Environments and payment service APIs

The environment determines which payment service API environment should connect to. For example, Braintree transactions made in the
`sandbox` environment are processed by the Braintree sandbox environment, while
transactions made in the `production` environment are processed by the Braintree
live environment.

Other actions such as registering a digital wallet are also dependent on the
environment. Apple Pay digital wallets registered using the `sandbox`
environment are registered with Apple Pay's sandbox environment. This wallet
is not recognized by Apple Pay's live environment and thus cannot be used in
`production`.

In short, the `production` environment always connects to the live API of a
payment service, whereas the `sandbox` environment always connects to its
sandbox API.
