API Cart Flow Details
Step 1: Create a customer
POST request for customer creation to http://localhost:8082/api/v1/customer
.
Body of the POST request:
<customer>
<firstName>Jane</firstName>
<lastName>Doe</lastName>
<emailAddress>Jane.Doe@test.com</emailAddress>
</customer>
Step 2: Create a cart associated with the new customer
Send a GET request to http://localhost:8082/api/v1/cart?customerId={customerId}
, substituting {customerId} with the customer ID returned in step 1.
This request will fetch the cart if it exists, otherwise it will create a new cart for the provided customer.
Step 3: Add an item to cart
Send a POST request to http://localhost:8082/api/v1/cart/{cartId}/item?customerId={customerId}
to add an item to the cart, replacing {customerId} with the customer ID returned in step 1, and {cartId} with the cart ID returned in step 2.
There is a optional isUpdateRequest
param which would instead update a cart item instead of adding the cart item.
Simple add item request body
{
"orderId": "1"
"productId": "100",
"quantity": "1",
"additionalAttributes": [
{
"key": "chooseOneDefaultProductId",
"value": "100"
},
{
"key": "addOnLabel",
"value": "Choose your shirt (Men's or Women's):"
},
{
"key": "addOnDisplayOrder",
"value": "1"
},
{
"key": "addOnXrefId",
"value": "1"
}
],
"orderItemAttributes": [
{
"name": "COLOR",
"value": "Red"
},
{
"name": "SIZE",
"value": "M"
}
]
}
Bundle add item request body
In the case of adding a bundle, an order item request body with its children order items is sent to the API.
This order item request body must have the bundle_setup_complete
set to true in the additionalAttributes
in order to be properly configured as a bundle.
{
"orderId": "1",
"childOrderItems": [
{
"productId": "100",
"quantity": "1",
"additionalAttributes": [
{
"key": "chooseOneDefaultProductId",
"value": "100"
},
{
"key": "addOnLabel",
"value": "Choose your shirt (Men's or Women's):"
},
{
"key": "addOnDisplayOrder",
"value": "1"
},
{
"key": "addOnXrefId",
"value": "1"
}
],
"orderItemAttributes": [
{
"name": "COLOR",
"value": "Red"
},
{
"name": "SIZE",
"value": "M"
}
]
},
{
"productId": "7",
"quantity": "1",
"additionalAttributes": [
{
"key": "addOnLabel",
"value": "Choose two 'Hawt' Sauces:"
},
{
"key": "addOnDisplayOrder",
"value": "2"
},
{
"key": "addOnXrefId",
"value": "2"
}
]
},
{
"productId": "17",
"quantity": "1",
"additionalAttributes": [
{
"key": "addOnLabel",
"value": "Choose two 'Hawt' Sauces:"
},
{
"key": "addOnDisplayOrder",
"value": "2"
},
{
"key": "addOnXrefId",
"value": "2"
}
]
}
],
"productId": "700",
"quantity": "1",
"additionalAttributes": [
{
"key": "bundle_setup_complete",
"value": true
}
]
}