> For the complete documentation index, see [llms.txt](https://developer.paddle.com/llms.txt).

# 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()`](https://developer.paddle.com/paddle-js/methods/paddle-checkout-updateitems.md), but also lets you pass discount and customer information. Typically used with [inline checkout](https://developer.paddle.com/build/checkout/build-branded-inline-checkout.md) 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](https://developer.paddle.com/paddle-js/methods/paddle-checkout-open.md) 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](https://developer.paddle.com/api-reference/prices/overview.md).

{% callout type="info" %}
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.
{% /callout %}

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](https://developer.paddle.com/api-reference/about/lists.md)

## Parameters

```yaml
title: Paddle.Checkout.updateCheckout() properties
type: object
properties:
  items:
    type: array
    description: >-
      List of items for this checkout. You must pass at least one item. Use the `updateItems()` or `updateCheckout()`
      method to update the items list.
    items:
      type: object
      properties:
        priceId:
          type: string
          examples:
            - pri_01gm81eqze2vmmvhpjg13bfeqg
          description: Paddle ID of the price for this item.
        quantity:
          type:
            - integer
            - "null"
          examples:
            - 1
          description: Quantity for this line item.
  customer:
    type: object
    description: Information about the customer for this checkout. Pass either an existing `id`, or the other fields.
    properties:
      id:
        type: string
        examples:
          - ctm_01gm82kny0ad1tk358gxmsq87m
        description: >-
          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:
        type:
          - string
          - "null"
        description: Email for this customer. You can't use if you're passing `id`.
      address:
        type: object
        description: Information about the customer address for this checkout. Pass either an existing `id`, or the other fields.
        properties:
          id:
            type:
              - string
              - "null"
            examples:
              - add_01gm82v81g69n9hdb0v9sw6j40
            description: >-
              Paddle ID for the customer address for this checkout. You can't use if you're passing any of the other
              address fields.
          countryCode:
            type: string
            examples:
              - US
            description: Two-letter ISO 3166 country code for this customer. You can't use if you're passing `id`.
          postalCode:
            type: string
            examples:
              - "10021"
            description: >-
              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`.
          region:
            type: string
            examples:
              - California
            description: >-
              State, county, or region of this address. Required if `business` is passed. You can't use if you're
              passing `id`.
          city:
            type: string
            examples:
              - Newport Beach
            description: City of this address. Required if `business` is passed. You can't use if you're passing `id`.
          firstLine:
            type: string
            examples:
              - Balboa Center
            description: First line of this address. Required if `business` is passed. You can't use if you're passing `id`.
      business:
        type: object
        description: Information about the customer business for this checkout. Pass either an existing `id`, or the other fields.
        properties:
          id:
            type: string
            examples:
              - biz_01gnymqsj1etmestb4yhemdavm
            description: >-
              Paddle ID for the customer business for this checkout. You can't use if you're passing `name` or
              `taxIdentifier`. Requires `address`.
          name:
            type: string
            examples:
              - Paddle.com Inc
            description: Name of the customer business. You can't use if you're passing `id`.
          taxIdentifier:
            type: string
            examples:
              - GB08172165
            description: Tax or VAT Number of the customer business. You can't use if you're passing `id`. Requires `address`.
  discountCode:
    type:
      - string
      - "null"
    examples:
      - BF20OFF
    description: >-
      Discount code to apply to this checkout. Use to prepopulate a discount. Pass either `discountCode` or
      `discountId`.
  discountId:
    type:
      - string
      - "null"
    examples:
      - dsc_01gtf15svsqzgp9325ss4ebmwt
    description: >-
      Paddle ID of a discount to apply to this checkout. Use to prepopulate a discount. Pass either `discountCode` or
      `discountId`.
  customData:
    type:
      - object
      - "null"
    examples:
      - '{ "crm_user_id": "123" }'
    description: >-
      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

{% accordion %}
{% accordion-item title="Update items and discount" %}

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.

{% tabs sync="paddlejs-preference" %}
{% tab-item title="Using a script tag" %}

```js
var updatedItemsList = [
  {
    priceId: "pri_01gm81eqze2vmmvhpjg13bfeqg",
    quantity: 10,
  },
  {
    priceId: "pri_01gm82kny0ad1tk358gxmsq87m",
    quantity: 1,
  },
];

Paddle.Checkout.updateCheckout({
  items: updatedItemsList,
  discountCode: "BF20OFF",
});
```

{% /tab-item %}
{% tab-item title="Using a JavaScript package manager" %}

```ts
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",
});
```

{% /tab-item %}
{% /tabs %}

To learn more, see [Pass or update checkout items](https://developer.paddle.com/build/checkout/pass-update-checkout-items.md)

{% /accordion-item %}
{% accordion-item title="Update custom data" %}

This example passes `customData` to `Paddle.Checkout.updateCheckout()`.

If successful, custom data on the open checkout is updated.

{% tabs sync="paddlejs-preference" %}
{% tab-item title="Using a script tag" %}

```js
Paddle.Checkout.updateCheckout({
  customData: {
    utm_medium: "social",
    utm_source: "linkedin",
    utm_content: "launch-video",
    integration_id: "AA-123",
  },
});
```

{% /tab-item %}
{% tab-item title="Using a JavaScript package manager" %}

```ts
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",
  },
});
```

{% /tab-item %}
{% /tabs %}

To learn more, see [Work with custom data](https://developer.paddle.com/build/transactions/custom-data.md)

{% /accordion-item %}
{% /accordion %}