Paddle.Update()
Updates values passed to Paddle.js during initialization.
Use Paddle.Update()
to update values sent to Paddle.js during initialization. This is typically used when working with single page applications to pass an updated customer to pwCustomer
when a customer is identified.
You must call Paddle.Initalize()
before calling Paddle.Update()
. Use the Paddle.Initialized
flag to determine whether you need to call Paddle.Initialize()
or Paddle.Update()
.
Parameters
Identifier for a logged-in customer for Paddle Retain. Pass an empty object if you don't have a logged-in customer. Paddle Retain is only loaded for live accounts.
Paddle ID for a customer entity in Paddle. Do not pass a subscription ID.
Function to call for Paddle.js events.
Examples
This example passes a new pwCustomer
to Paddle.js using Paddle.Update()
.
123451Paddle.Update({
2 pwCustomer: {
3 id: 'ctm_01gt25aq4b2zcfw12szwtjrbdt'
4 }
5});
This example checks if Paddle is initialized using the Paddle.Initialized
flag, then calls Paddle.Update()
to set pwCustomer
if not initialized.
123456789101112131415161718191if (Paddle.Initialized) {
2 Paddle.Update({
3 pwCustomer: {
4 id: 'ctm_01gt25aq4b2zcfw12szwtjrbdt'
5 }
6 }
7 );
8} else {
9 Paddle.Initalize({
10 token: 'live_7d279f61a3499fed520f7cd8c08',
11 checkout: {
12 displayMode: "overlay",
13 theme: "dark",
14 locale: "en"
15 },
16 pwCustomer: { },
17 }
18 );
19}