Make line item quantities adjustable
Create a Checkout Session with adjustable_quantity
enabled
Set adjustable_quantity
on your line_items
when creating a Checkout Session to enable your customers to update the quantity of an item during checkout.
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 999
for adjustable_quantity.maximum
.
When using adjustable quantities with a line_items[].quantity
value greater than 99
(the default adjustable maximum), set adjustable_quantity.maximum
to be greater than or equal to that item’s quantity.
If you use adjustable quantities, change your configuration so that it uses adjustable_quantity.maximum
when creating the Checkout Session to reserve inventory quantity instead of the line_items
quantity.
Checkout prevents the customer from removing an item if it is the only item remaining.
Handling completed transactions
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 is also removed from the line items response. See the Fulfillment guide to learn how to create an event handler to handle completed Checkout Sessions.
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.