Create Cart
Creates a new Cart
in Violet.
The id
property returned in the response is what we refer to as the Cart ID and will be required for each subsequent call when building and submitting the cart.
Carts are dynamic in Violet. Not all fields my be populated at any given point in time. If there are any issues during the Checkout process, errors will be present in the errors
field on the Cart
.
External Carts
For most ecommerce platforms this action will also result in the creation of equivalent external carts. One external cart will be created for each merchant that is included in the Violet cart. Each nested Bag
in the Violet cart will be directly linked to the external cart and will contain all of the Sku’s that are unique to that merchant.
If you do not intend to submit a cart we recommend that you delete the cart. This will ensure that no external carts are orphaned or abandoned in the merchants store(s).
Handling Cart Creation Errors
While we strive to ensure that cart creation succeeds, there may occassionally be scenarios where cart creations fails in a way where it cannot be automatically reconciled. The following examples show what to expect when cart creation failure occurs for single-bag and multi-bag carts.
Single Bag Cart Creation Errors
When the creation of a Violet cart containing a single Bag
results in a failed creation in the external platform, the error will be surfaced as an API Exception in the response body. This error will typically be surface with a 400
or 422
HTTP status.
500 Internal Server Error
being returned by the commerce platform.
Multi-Bag Cart Creation Errors
When the creation of a Violet cart containing multiple Bag
’s results in one or more failed creations in the external platforms, any error(s) will be nested in the "errors": []
array on the Cart
object.
entity_type
is SKU
, the entity_id
property will to the sku_id
that was provided in the cart creation request.
Query Parameters
Deprecated: Use request body instead.
Deprecated: Use request body instead.
Deprecated: Use request body instead.
Body
Optional data to initialize the cart with upon creation.
Response
Violet Order Entity