Cancels one or more items (products) in an order and returns the new order total. You can record a reason for the cancellation.
Before you begin#
- The API token needs
OrderItemList_Cancel, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need the order ID and the
line_idof each item.OrderList_Load_Queryreturns both.
Example requests#
Cancel items#
Cancels lines 153 and 165 of order 200100 and records why.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "OrderItemList_Cancel",
"Order_Id": "200100",
"Reason": "Customer called to remove items",
"line_ids": [153, 165]
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
Order_ID |
Number | Order Id | |
line_ids |
Array | Yes | Array of line ids to cancel |
Reason |
String | No | Reason for cancelling items |
Example response#
{
"success": 1,
"data": {
"total": 0.0,
"formatted_total": "$0.00"
}
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
total |
Number | Order Total after cancellation |
formatted_total |
String | Currency Formatted Order Total |
Error responses#
| Error Code | Error Message | Error Description |
|---|---|---|
| MER-JSN-ORD-00025 | Order number not found. | Order number not found |
| MER-JSN-00023 | One or more parameters are invalid | Missing line_ids parameter |
Related functions#
| Function | Use it to |
|---|---|
OrderList_Load_Query |
Find the order and its line IDs |
OrderItemList_BackOrder |
Put items on backorder instead |
OrderItemList_Delete |
Remove items from the order entirely |
OrderPayment_Refund |
Refund the payment for cancelled items |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Orders > OrderItemList_Cancel. See Set Up Postman.