XM
Members
Cancel Order
This documentation is now outdated, please find the latest docs for this endpoint here
Path:
1
PATCH https://{baseurl}/api-order/orders/cancel
Copied!
This API enables you (storefront context) to cancel an individual order. An order can be cancelled only if it is placed with in 24 hours and is not yet shipped. That is, an order can be cancelled only in the following statuses - Order_Payment_Authorized or Order_Created. This API is secured by x-api-key.

Headers

Content-Type : application/json
x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }
x-api-key : d41d8cd98f00b204e9800998ecf8427e

Parameters

Type: body
Name: The order ID and a cancellation code to cancel the order.
Required: true

Sample Request

Path:
1
PATCH https://{baseurl}/api-order/orders/cancel
Copied!
1
{
2
"orderId": "8568-9704-74294",
3
"cancellationCode": "2001"
4
}
Copied!

Response

Response Code: 200
Message: OK
Description: You will see this message when the requested order is successfully cancelled.
1
{
2
"orderId": "8568-9704-74294",
3
"status": "Successfully cancelled order"
4
}
Copied!
Error Code: 400
Message: Not Found
Description: You will see this error when the Order ID is not found.
1
{
2
"code": "ORDER_NOT_FOUND",
3
"message": "Order Id Not Found"
4
}
Copied!
Error Code: 400
Message: Bad Request
Description: You will see this error when the current status of the order doesn't support cancellation.
1
{
2
"code": "ORDER_CANCELLATION_INVALID",
3
"message": "Order status must be ORDER_PAYMENT_AUTHORIZED or ORDER_CREATED"
4
}
Copied!
Error Code: 400
Message: Bad Request
Description: You will see this error when the order is not within the cancellation window.
1
{
2
"code": "ORDER_CANCELLATION_INVALID",
3
"message": "Order was placed more than 24 hours ago"
4
}
Copied!
Error Code: 400
Message: Bad Request
Description: You will see this error when the specified order ID is lesser or greater than 15 characters.
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in body: /orderId should NOT be shorter than 15 characters"
4
}
Copied!
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
Last modified 1mo ago
Copy link
Contents
Change Log