Manage limited inventory with Checkout
Prevent customers from holding inventory in carts by expiring Checkout Sessions.
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 cancelling the sale and making those tickets available again. You can cancel a pending sale by expiring the Checkout Session.
Checkout supports both manual and timed session expiration. When a Checkout Session expires, its status property changes to expired
.
Manual expiration
To immediately expire an open Checkout Session and cancel any pending purchase, use the expire endpoint.
Set an expiration time
When you create a Checkout Session, specify an expiration timestamp by setting the expires_at parameter. The value must be between 30 minutes and 24 hours after the current time. If you don’t specify expires_
, the default value is 24 hours after the current time.
Return items to your inventory
When a Checkout Session expires, it triggers the checkout.
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.