How Order Creation Works
Order creation follows a cart-driven workflow. Product data is not accepted in the order creation request. All items must be added to the cart first, and the order is constructed from the cart state.
Step 1: Add Products to Cart
Each product must be added using the Add to Cart API. Multiple API calls are required to add multiple items. The cart maintains the complete set of items intended for the order.
Step 2: Create Order
The Create Order API constructs the order by retrieving the current state of the cart. No product-level data is accepted in this request.
Execution Flow
Items are added to the cart incrementally
Cart accumulates all required items
Create Order API is invoked
Order is created using the existing cart state
Constraints and Behavior
- Order creation requires a valid, non-empty cart
- The cart must be associated with the same user or session context
- All item modifications must be completed before invoking order creation
- The cart acts as the single source of truth for order data
Failure Conditions
- Request fails if the cart is empty
- Request fails if the cart is invalid or not found
- Request fails if cart ownership does not match the request context