# Manage limited inventory Prevent customers from holding inventory in carts by expiring Checkout Sessions. # Hosted page > This is a Hosted page for when payment-ui is stripe-hosted. View the full page at https://docs.stripe.com/payments/checkout/managing-limited-inventory?payment-ui=stripe-hosted. For some types of limited-inventory businesses, it’s necessary to prevent customers from reserving items for a long time without completing the purchase. For example, an event ticket seller wants to allow customers only a few minutes to buy their selected tickets before canceling the sale and making those tickets available again. You can cancel a pending sale by expiring the *Checkout Session* (A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout. After a successful payment, the Checkout Session contains a reference to the Customer, and either the successful PaymentIntent or an active Subscription). Checkout supports both manual and timed session expiration. When a Checkout Session expires, its [status property](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-status) changes to `expired`. ## Manual expiration To immediately expire an open Checkout Session and cancel any pending purchase, use the [expire](https://docs.stripe.com/api/checkout/sessions/expire.md) endpoint. ```curl curl -X POST https://api.stripe.com/v1/checkout/sessions/{{CHECKOUTSESSION_ID}}/expire \ -u "<>:" ``` ## Set an expiration time When you create a Checkout Session, specify an expiration timestamp by setting the [expires_at](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-expires_at) parameter. The value must be between 30 minutes and 24 hours after the current time. If you don’t specify `expires_at`, the default value is 24 hours after the current time. #### cURL ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d customer='{{CUSTOMER_ID}}' \ -d "line_items[0][price]"='{{PRICE_ID}}' \ -d "line_items[0][quantity]"=1 \ -d mode=payment \ -d success_url="https://example.com/success" \-d expires_at="{{NOW_PLUS_TWO_HOURS}}" ``` ## Return items to your inventory When a [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md) expires, Stripe sends the `checkout.session.expired` event. Configure your webhook endpoint to listen for this event so your webhook handler can return to inventory any items reserved in the expired session. For more information, see [Expire a Session](https://docs.stripe.com/api/checkout/sessions/expire.md). # Embedded page > This is a Embedded page for when payment-ui is embedded-form. View the full page at https://docs.stripe.com/payments/checkout/managing-limited-inventory?payment-ui=embedded-form. For some types of limited-inventory businesses, it’s necessary to prevent customers from reserving items for a long time without completing the purchase. For example, an event ticket seller wants to allow customers only a few minutes to buy their selected tickets before canceling the sale and making those tickets available again. You can cancel a pending sale by expiring the *Checkout Session* (A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout. After a successful payment, the Checkout Session contains a reference to the Customer, and either the successful PaymentIntent or an active Subscription). Checkout supports both manual and timed session expiration. When a Checkout Session expires, its [status property](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-status) changes to `expired`. ## Manual expiration To immediately expire an open Checkout Session and cancel any pending purchase, use the [expire](https://docs.stripe.com/api/checkout/sessions/expire.md) endpoint. ```curl curl -X POST https://api.stripe.com/v1/checkout/sessions/{{CHECKOUTSESSION_ID}}/expire \ -u "<>:" ``` ## Set an expiration time When you create a Checkout Session, specify an expiration timestamp by setting the [expires_at](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-expires_at) parameter. The value must be between 30 minutes and 24 hours after the current time. If you don’t specify `expires_at`, the default value is 24 hours after the current time. #### cURL ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d customer='{{CUSTOMER_ID}}' \ -d "line_items[0][price]"='{{PRICE_ID}}' \ -d "line_items[0][quantity]"=1 \ -d mode=payment \ -d ui_mode=embedded \ -d return_url="https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}" \-d expires_at="{{NOW_PLUS_TWO_HOURS}}" ``` ## Return items to your inventory When a [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md) expires, Stripe sends the `checkout.session.expired` event. Configure your webhook endpoint to listen for this event so your webhook handler can return to inventory any items reserved in the expired session. For more information, see [Expire a Session](https://docs.stripe.com/api/checkout/sessions/expire.md).