> For the complete documentation index, see [llms.txt](https://developer.paddle.com/llms.txt).

# Paddle.Environment.set()

Use to set your checkout environment to sandbox.

---

Use `Paddle.Environment.set()` to set the environment for your checkout.

Only used to set the [sandbox environment](https://developer.paddle.com/build/tools/sandbox.md). If not present, Paddle uses the production environment.

You should call this method before calling any other Paddle.js methods, ideally just before your [`Paddle.Initialize()`](https://developer.paddle.com/paddle-js/methods/paddle-initialize.md) call.

## Parameters

```yaml
title: Paddle.Environment.set() parameters
type: object
properties:
  environment:
    type: string
    default: production
    description: Paddle environment that you're working with.
    enum:
      - sandbox
      - production
    x-enum-descriptions:
      sandbox:
        description: Sandbox environment. Used for testing.
      production:
        description: Live environment. Used in production.
```

## Examples

{% accordion %}
{% accordion-item title="Checkout in sandbox environment" %}

This example sets the environment to `sandbox`.

{% tabs sync="paddlejs-preference" %}
{% tab-item title="Using a script tag" %}

```js
Paddle.Environment.set("sandbox");
Paddle.Initialize({
  token: "live_7d279f61a3499fed520f7cd8c08",
  pwCustomer: {},
});
```

{% /tab-item %}
{% tab-item title="Using a JavaScript package manager" %}

```ts
import { initializePaddle } from "@paddle/paddle-js";

const paddle = await initializePaddle({
  environment: "sandbox",
  token: "live_7d279f61a3499fed520f7cd8c08",
  pwCustomer: {},
});
```

{% /tab-item %}
{% /tabs %}

{% /accordion-item %}
{% accordion-item title="Checkout in production environment" %}

We recommend removing `Paddle.Environment.set()` before going live.

This example doesn't set the checkout environment. Paddle defaults to `production`.

{% tabs sync="paddlejs-preference" %}
{% tab-item title="Using a script tag" %}

```js
Paddle.Initialize({
  token: "live_7d279f61a3499fed520f7cd8c08",
  pwCustomer: {},
});
```

{% /tab-item %}
{% tab-item title="Using a JavaScript package manager" %}

```ts
import { initializePaddle } from "@paddle/paddle-js";

const paddle = await initializePaddle({
  token: "live_7d279f61a3499fed520f7cd8c08",
  pwCustomer: {},
});
```

{% /tab-item %}
{% /tabs %}

{% /accordion-item %}
{% /accordion %}