Paddle Billing
Search

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'd like 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

itemsarray[object]

List of items for this checkout. You must pass at least one item. Use the updateItems() or updateCheckout)() method to update the items list.

priceIdstring<Paddle ID>

Paddle ID of the price for this item.

quantityinteger or null

Quantity for this line item.

customerobject

Information about the customer for this checkout. Pass either an existing id, or the other fields.

idstring<Paddle ID> or null

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.

emailstring<email> or null

Email for this customer. You can't use if you're passing id.

addressobject

Information about the customer address for this checkout. Pass either an existing id, or the other fields.

businessobject

Information about the customer business for this checkout. Pass either an existing id, or the other fields.

discountCodestring or null

Discount code to apply to this checkout. Use to pre-populate a discount. Pass either discountCode or discountId.

discountIdstring<Paddle ID> or null

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.

Events

checkout.updatedEmitted when the checkout is updated using Paddle.Checkout.updateCheckout().
checkout.items.updatedEmitted when the checkout items list is updated.
checkout.items.removedEmitted when an item is removed from the checkout.
checkout.discount.appliedEmitted when an update to a checkout applies a discount.
checkout.discount.removedEmitted when an update to a checkout removes a discount.
checkout.customer.updatedEmitted when an update to a checkout updates a customer.
checkout.customer.removedEmitted when an update to a checkout removes a customer.

Related pages