Stripe | Financial Infrastructure to Grow Your Revenue

Stripe | Financial Infrastructure to Grow Your Revenue

4466 articles

Make line item quantities adjustable


Make line item quantities adjustable

Learn how to allow your customers to adjust the quantity of items during checkout.

The line items for each Checkout Session keep track of what your customer is purchasing. You can configure the Checkout Session so customers can adjust line item quantities during checkout.

Payment Intents API

If you use the Payment Intents API, you must manually track line item updates and modify the payment amount, or by creating a new PaymentIntent with adjusted amounts.

Enable adjustable quantities Server-side

Other line item updates, such as adding new line items, aren’t supported for this integration.

Set adjustable_quantity on your line_items when creating a Checkout Session to allow your customers to update the quantity of an item during checkout.

Command Line

Select a language

cURL

Stripe CLI

Ruby

Python

PHP

Java

Node.js

Go

.NET

No results

You can customize the default settings for the minimum and maximum quantities allowed by setting adjustable_quantity.minimum and adjustable_quantity.maximum. By default, an item’s minimum adjustable quantity is 0 and the maximum adjustable quantity is 99. You can specify a value of up to 999999 for adjustable_quantity.maximum.

Checkout prevents the customer from removing an item if it’s the only item remaining.

Update line item quantities Client-side

Use updateLineItemQuantity to change a line item’s quantity in response to customer interaction, such as a button to increment the quantity. Pass the line item ID and the new quantity:

index.html

<button class="increment-quantity-button" data-line-item="{{line item ID}}">+</button>

checkout.js

const checkout = stripe.initCheckoutElementsSdk({clientSecret});
const button = document.querySelector('.increment-quantity-button');
const lineItem = button.getAttribute("data-line-item");
checkout.loadActions().then((loadActionsResult) => {
 if (loadActionsResult.type === 'success') {
 const {actions} = loadActionsResult;
 const session = loadActionsResult.getSession();
 const quantity = session.lineItems.find((li) => li.id === lineItem).quantity;
 button.addEventListener('click', () => {
 actions.updateLineItemQuantity({
 lineItem,
 quantity: quantity + 1,
 })
 });
 } else {
 const {error} = loadActionsResult;
 }
});

Handle completed transactions Server-side

After the payment completes, you can make a request for the finalized line items and their quantities. If your customer removes a line item, it’s also removed from the line items response. See the Fulfillment guide to learn how to create an event handler to handle completed Checkout Sessions.

Note

To test your event handler, install the Stripe CLI and use stripe listen --forward-to localhost:4242/webhook to forward events to your local server.

Select a language

Ruby

Python

PHP

Java

Node.js

Go

.NET

No results

Last verified 2026-09-24

Is this helpful?