XM

Delete Cart

Path:

PATCH https://{baseurl}/api-cart/cart/{cartId}/orderNumber

This API is automatically triggered when the checkout is complete, to delete the existing cart. At a later point, when the user picks up an item, a new cart (with a new cartId) is created.

Headers

Content-Type : application/json

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type : path

Name : The 24 character system-generated cart ID (from the Add Items to Cart or Retrieve Cart by userAuthToken API).

Required: true

Type : requestBody

Name : The order number that is generated after a successful checkout.

Required: true

Sample Request

Path:

PATCH https://{baseurl}/api-cart/cart/60807478d14ffd000843db2c/orderNumber

Request Body:

{
"orderNumber": "1234-1234-12345"
}

Response

Response Code: 200

Message: OK

Description: You'll see this message when the cart is successfully deleted.

{
"_id": "60807478d14ffd000843db2c",
"deleted": true,
"registeredUser": false,
"cartId": 1493,
"items": [
{
"price": {
"discount": {
"discountAmount": 0,
"price": 0,
"promosApplied": []
},
"sale": 0,
"base": 900,
"currency": "USD"
},
"sample": false,
"discountedQuantity": 0,
"group": [
"123123123123123213212222"
],
"weightUnit": "lb",
"isPickup": false,
"createdAt": "2021-04-21T18:51:24.975Z",
"updatedAt": "2021-04-21T18:52:42.418Z",
"_id": "60807478d14ffd000843db2d",
"itemId": 1000000051,
"priceListId": 100269,
"quantity": 2,
"sku": "1538910",
"taxCode": "PH060771",
"title": "Luminous Cushion Lagoon",
"weight": 1,
"lineItemId": 1,
"attributeTotalPrice": 0,
"totalPrice": {
"currency": "USD",
"amount": 1800
},
"attributes": [],
"id": "60807478d14ffd000843db2d"
}
],
"allPromosApplied": [],
"attributes": [],
"createdAt": "2021-04-21T18:52:40.513Z",
"updatedAt": "2021-04-21T18:53:59.793Z",
"__v": 0,
"orderNumber": "1234-1234-12345",
"totalAmount": {
"currency": "USD",
"amount": 1800
},
"quantity": 2
}

Response Code: 404

Message: Not found

Description: You will see this error when the cart ID doesn't exist in the system.

{
"code": "CART_NOT_FOUND",
"message": "Cart not found."
}

Response Code: 400

Message: Request validation

Description: You will see this error when the cart ID is lesser or greater than 24 characters.

{
"code": "REQUEST_VALIDATION",
"message": "Invalid data in path: /cartId should NOT be shorter than 24 characters"
}

Error Code: 500

Message: Internal Server Error

Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

  • June - 2021

  • July - 2020 First updated