XM

Cancel Orders in Bulk

Path:

POST https://{baseurl}/api-order/orders/bulk-cancel

This API enables you (store admin context) to cancel orders in bulk. And, this is secured by x-api-key. Only the order placed with in 24 hours and are not yet shipped can be cancelled. That is, an order can be cancelled only in the following statuses - Order_Payment_Authorized or Order_Created. When all the orders in the request is successfully cancelled, the response includes a list of order IDs along with the status - Successfully cancelled order. If one or more orders in the request couldn't be cancelled, the response will additionally include (error) code and message fields to highlight the error reason.

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 list of order IDs along with their cancellation code.

Required: true

Sample Request

Path:

POST https://{baseurl}/api-order/orders/bulk-cancel
[
{
"orderId": "3577-2415-52733",
"cancellationCode": "1001"
},
{
"orderId": "6562-1726-73447",
"cancellationCode": "2001"
}
]

Response

Response Code: 200

Message: OK

Description: You will see this message when the requested orders are successfully cancelled. If any of the orders couldn't be cancelled, the 'status' field shows as 'Error' and two additional fields 'code' and 'message' are displayed in the response to highlight the reason.

[
{
"orderId": "6562-1726-73447",
"status": "Error",
"code": "ORDER_CANCELLATION_INVALID",
"message": "Order status must be ORDER_PAYMENT_AUTHORIZED or ORDER_CREATED"
},
{
"orderId": "3577-2415-52733",
"status": "Successfully cancelled order"
}
]

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