Paddle.Checkout.updateCheckout()
Updates the list of items, discounts, customer, address, and business for an open checkout.
Use Paddle.Checkout.updateCheckout()
to dynamically update the items list, discount, and customer information for an open checkout.
This method is similar to Paddle.Checkout.updateItems()
, but also lets you pass discount and customer information. Typically used with inline checkout to change the items list while adding, removing, or changing a discount.
To use this method, a checkout should already be opened. Use the Paddle.Checkout.open()
method to open a checkout.
To update items, pass an array of objects, where each object contains a priceId
and quantity
property. priceId
should be a Paddle ID of a price entity.
Recurring items on a checkout must have the same billing interval. For example, you can't have a checkout with some prices that are billed monthly and some products that are billed annually.
Paddle expects the complete list of items that you want to be on the checkout — including existing items. If you don't include an existing item, it's removed from the checkout. See: Work with lists
Parameters
List of items for this checkout. You must pass at least one item. Use the updateItems()
or updateCheckout()
method to update the items list.
Paddle ID of the price for this item.
Quantity for this line item.
Information about the customer for this checkout. Pass either an existing id
, or the other fields.
Paddle ID of the customer for this checkout. Use if you know the customer, like if they're authenticated and making a change to their subscription. You can't use if you're passing email
.
Email for this customer. You can't use if you're passing id
.
Information about the customer address for this checkout. Pass either an existing id
, or the other fields.
Information about the customer business for this checkout. Pass either an existing id
, or the other fields.
Discount code to apply to this checkout. Use to pre-populate a discount. Pass either discountCode
or discountId
.
Paddle ID of a discount to apply to this checkout. Use to pre-populate a discount. Pass either discountCode
or discountId
.
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.
1234567891011121314151var updatedItemsList = [
2 {
3 priceId: 'pri_01gm81eqze2vmmvhpjg13bfeqg',
4 quantity: 10
5 },
6 {
7 priceId: 'pri_01gm82kny0ad1tk358gxmsq87m',
8 quantity: 1
9 }
10];
11
12Paddle.Checkout.updateCheckout({
13 items: updatedItemsList,
14 discountCode: "BF20OFF"
15});
See: Pass or update checkout items
Events
checkout.updated | Emitted when the checkout is updated using Paddle.Checkout.updateCheckout() . |
checkout.items.updated | Emitted when the checkout items list is updated. |
checkout.items.removed | Emitted when an item is removed from the checkout. |
checkout.discount.applied | Emitted when an update to a checkout applies a discount. |
checkout.discount.removed | Emitted when an update to a checkout removes a discount. |
checkout.customer.updated | Emitted when an update to a checkout updates a customer. |
checkout.customer.removed | Emitted when an update to a checkout removes a customer. |