Lifecycle of a Cart → Order
Checkout Anywhere is a key part of Violet's product. When working with Violet's checkout APIs, it's important to understand the different stages of a Cart and an Order: before, during, and after checkout. Let's start with defining the important parts of an Order.
A SKU is the product a Shopper is buying. A SKU is added to a Shopper's cart using the SKU ID. In Violet, a SKU is found in a Bag. You can have multiple SKUs in a Bag.
A Bag belongs to an individual Merchant. When a SKU is added to a cart, it's added to a Bag, which exists inside an Order. You can have multiple bags in an Order.
A Cart is an uncompleted Order. When a Cart is submitted the cart_id becomes the order_id
An Order is a unique record for a single purchase. An Order can have several Bags, which can hold several SKUs each.
Order Status Flow
To turn a Cart into an Order, it must go through three statuses: IN_PROGRESS, PROCESSING, and COMPLETE. Let’s walk through the steps a Shopper takes to checkout and what that means when using Violet.
Before Checkout: No Cart
The Shopper is browsing through the Violet Catalog but has not yet added any items to their Cart. Since no items have been added, no Cart ID has been created for this shopping session.
During Checkout: Add to Cart
When a Shopper adds an item to their Cart in the UI, the action can be mirrored via Violet. This adds the SKU to a Cart, which generates a Cart ID, a Bag ID, and an SKU ID.
A Cart starts with a status of IN_PROGRESS and remains in that status until it is submitted. No Checkout operations will change the status of a Cart except for submission (or deletion).
When a Cart is submitted, it moves to PROCESSING. This is a transient status, as a Cart will not remain here for its end state. While in PROCESSING, the actions are happening on the Bags themselves as they are being individually submitted to e-commerce platforms for each merchant.
After Checkout: Cart ID → Order ID
The Cart id that you use during checkout becomes the Order id once that Checkout is completed. This means any Order ID with the status of IN_PROGRESS is technically still a cart that has not yet completed checkout.
When the bags are accepted, the Cart is marked as COMPLETE, which means it has "become" an Order. No more Checkout operations can be performed on it.
Once an Order is marked as COMPLETE, it stays in that status. If Bags under it are refunded, returned, or cancelled, the Order remains in a COMPLETE status since all the actions of Violet were completed for this Order. The Bags themselves will reflect the status of the individual merchant actions.
Now that we’ve covered the high level status of an Order or time, let’s take a look at the next level of detail driving the whole experience: Bags.
- Bag Status
- Financial Status
- Fulfillment Status
- SKU Status
We will cover each of those status types in the subsequent pages.