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. To learn more, see Work with lists
Parameters
updateItems() or updateCheckout() method to update the items list.pri_01gm81eqze2vmmvhpjg13bfeqg1id, or the other fields.ctm_01gm82kny0ad1tk358gxmsq87memail.id.id, or the other fields.add_01gm82v81g69n9hdb0v9sw6j40USid.10021id.Californiabusiness is passed. You can't use if you're passing id.Newport Beachbusiness is passed. You can't use if you're passing id.Balboa Centerbusiness is passed. You can't use if you're passing id.id, or the other fields.biz_01gnymqsj1etmestb4yhemdavmname or taxIdentifier. Requires address.Paddle.com Incid.GB08172165id. Requires address.BF20OFFdiscountCode or discountId.dsc_01gtf15svsqzgp9325ss4ebmwtdiscountCode or discountId.{ "crm_user_id": "123" }Your own structured key-value data to include with this checkout. Passed data is held against the related transaction. If a transaction is for recurring items, custom data is copied to the related subscription when created.
If custom data already exists, it's replaced. Must be valid JSON and contain at least one key.
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.
var updatedItemsList = [ { priceId: "pri_01gm81eqze2vmmvhpjg13bfeqg", quantity: 10, }, { priceId: "pri_01gm82kny0ad1tk358gxmsq87m", quantity: 1, },];
Paddle.Checkout.updateCheckout({ items: updatedItemsList, discountCode: "BF20OFF",});import { initializePaddle } from "@paddle/paddle-js";
const paddle = await initializePaddle({ token: "live_7d279f61a3499fed520f7cd8c08",});
const updatedItemsList = [ { priceId: "pri_01gm81eqze2vmmvhpjg13bfeqg", quantity: 10, }, { priceId: "pri_01gm82kny0ad1tk358gxmsq87m", quantity: 1, },];
paddle?.Checkout.updateCheckout({ items: updatedItemsList, discountCode: "BF20OFF",});To learn more, see Pass or update checkout items
This example passes customData to Paddle.Checkout.updateCheckout().
If successful, custom data on the open checkout is updated.
Paddle.Checkout.updateCheckout({ customData: { utm_medium: "social", utm_source: "linkedin", utm_content: "launch-video", integration_id: "AA-123", },});import { initializePaddle } from "@paddle/paddle-js";
const paddle = await initializePaddle({ token: "live_7d279f61a3499fed520f7cd8c08",});
paddle?.Checkout.updateCheckout({ customData: { utm_medium: "social", utm_source: "linkedin", utm_content: "launch-video", integration_id: "AA-123", },});To learn more, see Work with custom data
Events
checkout.updated | Emitted when a checkout is updated using one of the checkout update methods. |
checkout.items.updated | Emitted when an item is updated on a checkout. |
checkout.items.removed | Emitted when an item is removed from a checkout. |
checkout.discount.applied | Emitted when a discount is applied to a checkout. |
checkout.discount.removed | Emitted when a discount is removed from a checkout. |
checkout.customer.updated | Emitted when customer information is updated. |
checkout.customer.removed | Emitted when a customer is removed from a checkout. |