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

# Update pwCustomer and eventCallback after Paddle.js is initialized

Use a new method to update the customer for Paddle Retain and pass an event callback after you've initialized Paddle.js. Plus, a new method for initializing Paddle.js.

---

## What's new?

We added a new [`Paddle.Update()`](https://developer.paddle.com/paddlejs/methods/paddle-update.md) method that you can use to update Paddle.js after [initialization](https://developer.paddle.com/paddlejs/include-paddlejs.md).

As part of this change, we replaced `Paddle.Setup()` with [`Paddle.Initialize()`](https://developer.paddle.com/paddlejs/methods/paddle-initialize.md). You don't need to make any changes to your integration immediately.

## How it works

### Paddle.Update()

When you [initialize Paddle.js](https://developer.paddle.com/paddlejs/include-paddlejs.md), you can pass the customer for [Paddle Retain](https://developer.paddle.com/build/retain/set-up-retain-profitwell.md) engagement using the `pwCustomer` parameter. You may also pass an `eventCallback` to [handle events emitted by Paddle.js](https://developer.paddle.com/paddlejs/events/overview.md).

Paddle.js can only be initialized once on a page. This means that previously there was no way to update `pwCustomer` or `eventCallback` after initialization. This could be a problem when working with single page applications, or when dynamically setting event callbacks based on things like payment flow.

We added a new [`Paddle.Update()`](https://developer.paddle.com/paddlejs/methods/paddle-update.md) method that you can call after initialization to update values passed to Paddle.js. We support updating `pwCustomer` and `eventCallback`.

`Paddle.Update()` may only be called after initialization. You can use a new `Paddle.Initialized` flag to determine whether Paddle.js is initialized.

### Paddle.Initialize()

To make it clearer that Paddle.js may only be initialized once per page, we replaced `Paddle.Setup()` with [`Paddle.Initialize()`](https://developer.paddle.com/paddlejs/methods/paddle-initialize.md).  It's functionally the same as `Paddle.Setup()`, supporting all the same parameters.

`Paddle.Setup()` is now considered deprecated, but you don't need to do anything right away. We still support using `Paddle.Setup()` to initialize Paddle.js. Existing integrations are not impacted.

## Example

{% accordion %}

{% accordion-item title="Update customer for Retain" %}

This example passes a new `pwCustomer` to Paddle.js using `Paddle.Update()`.

<!-- This example updates pwCustomer -->
```javascript {% highlightLines="[2,3,4]" %}
Paddle.Update({
  pwCustomer: {
    id: 'ctm_01gt25aq4b2zcfw12szwtjrbdt'
  }
});
```

{% /accordion-item %}

{% accordion-item title="Check if Paddle is initialized before updating" %}

This example checks if Paddle is initialized using the `Paddle.Initialized` flag, then calls `Paddle.Update()` to set `pwCustomer` if not initialized.

<!-- This example shows how to check Paddle.Initialized -->
```javascript
if (Paddle.Initialized) {
  Paddle.Update({
      pwCustomer: {
        id: 'ctm_01gt25aq4b2zcfw12szwtjrbdt'
      }
    }
  );
} else {
  Paddle.Initialize({
      token: 'live_7d279f61a3499fed520f7cd8c08',
      checkout: {
        displayMode: "overlay",
        theme: "dark",
        locale: "en"
      },
      pwCustomer: { },
    }
  );
}
```

{% /accordion-item %}

{% /accordion %}

## Next steps

This change is live in Paddle.js now, so you can start using `Paddle.Update()` and [`Paddle.Initialize()`](https://developer.paddle.com/paddlejs/methods/paddle-initialize.md) when you're ready.

You don't need to do anything to get the latest version of Paddle.js — we serve the latest version automatically.

We recommend that you replace `Paddle.Setup()` with `Paddle.Initialize()` and when you're next reviewing your code.
## Summary of changes

| Name | Type | Change | Entity | Description |
| --- | --- | --- | --- | --- |
| `Paddle.Update()` | Paddle.js method | added | Paddle.js | Use to update Paddle.js after initialization. |
| `Paddle.Initialize()` | Paddle.js method | added | Paddle.js | Use to initialize Paddle.js. |
| `Paddle.Setup()` | Paddle.js method | deprecated | Paddle.js | Use Paddle.Initialize() instead. |
