State transitions for order
This topic explains the state transitions for orders, detailing how order and line item states affect the overall order status.
The following diagram illustrates the state transitions of an order.
When an order is submitted, the order state becomes Executing, which will:
-
Execute all order actions that are not pending
-
Put all order line items to the Executing state (unless another State is specified for the order line item in the
itemStatefield in the Orders UI or API)
An order is Complete only when:
-
All order actions are executed (activated)
-
And all order line items are complete
An order is Canceled when:
-
No subscription (or order action) is in it
-
And if all order items are canceled.
In summary, the state of an order is determined by two sets of factors:
-
State of each of the order line items within the order
-
Status of the order itself. See Order Status .
Note that the field you can see in the Orders UI is the
Status
field, not the
state
field.
The following sections describe the order state in different scenarios.
When only order line items are present in the order
When only order line items are present in the order, the order state is as below:
-
When any order line item in the order is in the Executing state, the order is in the Executing state.
-
When any order line item in the order is in the SentToBilling state, the order is in the Executing state.
-
When all order line items in the order are in the Complete state, the order is in the Complete state.
-
When all order line items in the order are in the Canceled state, the order is in the Canceled state.
-
When some order line items in the order are in the Complete state and the other order line items are in the Canceled state, the order is in the Complete state.
When only subscriptions are present in the order
When only subscriptions are present in the order, the order state is determined by the status of the order.
-
When the status of the order is Draft, the order is in the Executing state.
-
When the status of the order is Pending, the order is in the Executing state.
-
When the status of the order is Completed, the order is in the Complete state.
When both order line items and subscriptions are present in the order
When both order line item and subscription are present in the order, the order state can be either Executing or Complete.
-
When the order status is Pending, the order state is Executing.
-
When any of the order line items in the order is in the Executing or SentToBilling state, the order is the Executing state.
-
When all of the order line items in the order are in the Complete state and the order status is Completed, the order is in the Complete state.
-
When all of the order line items in the order are in the Canceled state and the order status is Completed, the order is in the Complete state.
-
When some of the order line items in the order are in the Complete state, the other of the order line items in the order are in the Canceled state, and the order status is Completed, the order is in the Complete state.