Docs

Update an open checkout using Paddle.js

Pass items, discount, and customer information to a new Paddle.js method to update an open checkout.

Tooling

  • Paddle.js
  • Checkout

Released

September 29, 2023

Status

Released

What's new?

We added a new Paddle.Checkout.updateCheckout() method to Paddle.js that you can use to update items, discount, and customer information for an open checkout.

To complement this, we added a new checkout.updated event that's emitted when a checkout is updated using this new method.

How it works

You can use Paddle.Checkout.updateItems() to dynamically update items on an open checkout. This method only lets you update items, so it's perfect for simpler inline checkout implementations where you might want to add, remove, or change quantities of items on a checkout.

In more complex implementations, you might like to swap or remove a discount at the same time as changing items. For example, some discounts may be restricted to particular products or prices, so changing items on a checkout might make the discount incompatible.

The new Paddle.Checkout.updateCheckout() method lets you update discount and customer information, as well as updating items. You can pass discountId or discountCode along with an array of items to swap or remove the discount on an open checkout.

Examples

This example passes an array of items and a discount code to Paddle.Checkout.updateCheckout().

If successful, the items and the discount on the opened checkout are updated.

Paddle.Checkout.updateCheckout()
var updatedItemsList = [
{
priceId: 'pri_01gm81eqze2vmmvhpjg13bfeqg',
quantity: 10
},
{
priceId: 'pri_01gm82kny0ad1tk358gxmsq87m',
quantity: 1
}
];
Paddle.Checkout.updateCheckout({
items: updatedItemsList,
discountCode: "BF20OFF"
});

Next steps

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

Summary of changes

Entity Field Change Type
Paddle.js Paddle.Checkout.updateCheckout + Added Paddle.js method
Use to update items, discount, and customer information for an open checkout.
Paddle.js checkout.updated + Added Paddle.js event
Emitted when a checkout is updated using the new Paddle.Checkout.updateCheckout method.

Was this page helpful?