Paddle Billing
Search

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() method that you can use to update Paddle.js after initialization.

As part of this change, we replaced Paddle.Setup() with Paddle.Initialize(). You don't need to make any changes to your integration immediately.

How it works

Paddle.Update()

When you initialize Paddle.js, you can pass the customer for Paddle Retain engagement using the pwCustomer parameter. You may also pass an eventCallback to handle events emitted by Paddle.js.

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

Next steps

This change is live in Paddle.js now, so you can start using Paddle.Update() and Paddle.Initialize() 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.

Learn more