Docs

Paddle.Checkout.updateCheckout()

Use to update 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.

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

itemsarray
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
Example: pri_01gm81eqze2vmmvhpjg13bfeqg
Paddle ID of the price for this item.
quantityinteger | null
Example: 1
Quantity for this line item.
customerobject
Information about the customer for this checkout. Pass either an existing id, or the other fields.
idstring
Example: ctm_01gm82kny0ad1tk358gxmsq87m
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 | 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.
idstring | null
Example: add_01gm82v81g69n9hdb0v9sw6j40
Paddle ID for the customer address for this checkout. You can't use if you're passing any of the other address fields.
countryCodestring
Example: US
Two-letter ISO 3166 country code for this customer. You can't use if you're passing id.
postalCodestring
Example: 10021
ZIP or postal code of this address. Paddle Checkout only asks for this in countries with postal codes. You can't use if you're passing id.
regionstring
Example: California
State, county, or region of this address. Required if business is passed. You can't use if you're passing id.
citystring
Example: Newport Beach
City of this address. Required if business is passed. You can't use if you're passing id.
firstLinestring
Example: Balboa Center
First line of this address. Required if business is passed. You can't use if you're passing id.
businessobject
Information about the customer business for this checkout. Pass either an existing id, or the other fields.
idstring
Example: biz_01gnymqsj1etmestb4yhemdavm
Paddle ID for the customer business for this checkout. You can't use if you're passing name or taxIdentifier. Requires address.
namestring
Example: Paddle.com Inc
Name of the customer business. You can't use if you're passing id.
taxIdentifierstring
Example: GB08172165
Tax or VAT Number of the customer business. You can't use if you're passing id. Requires address.
discountCodestring | null
Example: BF20OFF
Discount code to apply to this checkout. Use to prepopulate a discount. Pass either discountCode or discountId.
discountIdstring | null
Example: dsc_01gtf15svsqzgp9325ss4ebmwt
Paddle ID of a discount to apply to this checkout. Use to prepopulate a discount. Pass either discountCode or discountId.
customDataobject | null
Example: { "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.

Paddle.Checkout.updateCheckout()
var updatedItemsList = [
{
priceId: "pri_01gm81eqze2vmmvhpjg13bfeqg",
quantity: 10,
},
{
priceId: "pri_01gm82kny0ad1tk358gxmsq87m",
quantity: 1,
},
];
Paddle.Checkout.updateCheckout({
items: updatedItemsList,
discountCode: "BF20OFF",
});
paddle.Checkout.updateCheckout()
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()
Paddle.Checkout.updateCheckout({
customData: {
utm_medium: "social",
utm_source: "linkedin",
utm_content: "launch-video",
integration_id: "AA-123",
},
});
paddle.Checkout.updateCheckout()
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.

Was this page helpful?