Docs

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. 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() call.

Parameters

environmentstring
Default: production
Paddle environment that you're working with.
Values
  • sandbox
    Sandbox environment. Used for testing.
  • production
    Live environment. Used in production.

Examples

This example sets the environment to sandbox.

JavaScript
Paddle.Environment.set("sandbox");
Paddle.Initialize({
token: "live_7d279f61a3499fed520f7cd8c08",
pwCustomer: {},
});
TypeScript
import { initializePaddle } from "@paddle/paddle-js";
const paddle = await initializePaddle({
environment: "sandbox",
token: "live_7d279f61a3499fed520f7cd8c08",
pwCustomer: {},
});

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

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

JavaScript
Paddle.Initialize({
token: "live_7d279f61a3499fed520f7cd8c08",
pwCustomer: {},
});
TypeScript
import { initializePaddle } from "@paddle/paddle-js";
const paddle = await initializePaddle({
token: "live_7d279f61a3499fed520f7cd8c08",
pwCustomer: {},
});

Was this page helpful?