Checkout Lifecycle
Checkout Creation
Upon creation, checkout
is assigned to a channel that influences product stock, availability, and price. The channel can not be changed after the checkout is created. Learn more about Channels.
Checkout can be created from existing orders, which is helpful for re-order functionality.
Updating Checkout
- Updating lines. Each line (product variant) should have at least a quantity of 1; if the line reaches a quantity of 0, it will be automatically removed. Optionally Price overwrites and Line Stacking can be controlled via API.
Completing Checkout
When checkout is finalized/completed, it is converted into an order.
The following are the requirements to finalize the checkout:
-
The required addresses are valid, except when
skipValidation
is used. -
Delivery options and addresses are valid. Learn more.
-
All selected products are in stock (while purchasing, another user could already buy the last available item). See
Allocations
andReservations
. -
The payments are processed unless the
Channel
setting of the checkout hasallowUnpaidOrders
setting enabled or checkout's total is0
. If you need to bypass this setting, you useorderCreateFromCheckout
.
If case an order is overcharged, it will still be created. The overcharge must be handled manually.
Checkout Expiration and Deletion
To avoid overloading the database, unfinished and unpaid checkouts are automatically deleted after a specified period from their last modification:
- checkouts without lines after 6 hours,
- anonymous checkouts (neither user nor email is set) with lines after 30 days,
- user checkouts (either user or email is set) with lines after 90 days.
Releasing Funds for Abandoned Checkouts
Payments for items left in the cart by customers who did not complete the purchase will be refunded to the customer's account.
Abandoned checkout is the checkout that hasn't been changed in a specific period. The TTL is controlled by the environment variable: CHECKOUT_TTL_BEFORE_RELEASING_FUNDS
, a default set to 6 hours.
For any transactionItem
with processed funds (authorizedAmount
or chargeAmount
) assigned to abandoned checkout, Saleor will trigger the release action.
The release action is:
- webhook with the event:
TRANSACTION_CANCELATION_REQUESTED
triggered whentransactionItem
contains authorized funds - webhook with the event:
TRANSACTION_REFUND_REQUESTED
triggered whentransactionItem
contains charged funds.
The release action is triggered only once. If a subscription for a release event is missing or the app fails to process the action, the release action needs to be handled manually.
To fetch paid checkouts, use the below query:
{
checkouts(first: 10, filter: { authorizeStatus: [PARTIAL, FULL] }) {
edges {
node {
totalBalance {
amount
}
}
}
}
}