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

# Paddle.js wrapper

Install the Paddle.js wrapper to load Paddle.js using a JavaScript package manager, with full TypeScript definitions.

---

The Paddle.js wrapper (`@paddle/paddle-js`) is a typed ES-module wrapper around Paddle.js. Install it using a JavaScript package manager and import `initializePaddle` directly, with full TypeScript definitions for every method.

{% version-badge sdk="paddle-js" /%}

{% card-group cols=2 %}
{% card title="GitHub" icon="carbon:logo-github" url="https://github.com/PaddleHQ/paddle-js-wrapper" %}
View source code and report issues on GitHub.
{% /card %}
{% card title="npm package" icon="devicon-plain:npm" url="https://www.npmjs.com/package/@paddle/paddle-js" %}
View and install on npm.
{% /card %}
{% /card-group %}

Use the wrapper when you're working in a bundled JavaScript or TypeScript project, like Next.js, Remix, Astro, Vite, or similar. If you're loading Paddle.js from a `<script>` tag instead, see [Include and initialize Paddle.js](https://developer.paddle.com/paddle-js/include-paddlejs.md).

## Install

{% code-group sync="js-package-manager" %}

```bash {% title="pnpm" %}
pnpm add @paddle/paddle-js
```

```bash {% title="yarn" %}
yarn add @paddle/paddle-js
```

```bash {% title="npm" %}
npm install @paddle/paddle-js
```

{% /code-group %}

## Initialize

Import `initializePaddle` and call it with a client-side token. Client-side tokens are created in **Paddle > Developer tools > Authentication**. Sandbox tokens are prefixed with `test_`.

```typescript
import { initializePaddle, type Paddle } from '@paddle/paddle-js';

const paddle: Paddle | undefined = await initializePaddle({
  environment: 'sandbox',
  token: process.env.NEXT_PUBLIC_PADDLE_CLIENT_TOKEN!,
});
```

Drop `environment`, or set it to `production`, for live accounts.

## Full usage

The wrapper exposes the same API as Paddle.js itself. For full documentation of every method and event, see:

- [Include and initialize Paddle.js](https://developer.paddle.com/paddle-js/include-paddlejs.md): full setup including Retain.
- [Paddle.js methods](https://developer.paddle.com/paddle-js/methods.md): every method the wrapper exposes.
- [Paddle.js events](https://developer.paddle.com/paddle-js/events.md): every event you can listen for.