Cancel order
POST api.foodin.ai/users/{ user_id }/orders/{ order_id }/cancel;
Request
Parameters
Field | Type | Description |
---|---|---|
user_id | string | The ID of the user. |
order_id | string | The ID of the order. |
Request examples
const axios = require("axios");
const options = {
method: "POST",
url: "https://api.foodin.ai/users/{user_id}/orders/{order_id}/cancel",
headers: {
Accept: "application/json",
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
};
axios(options)
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});
Response
Example
{
"id": "12345676789012345678780",
"status": "canceled",
"order_url": "https://foodin.ai/example_store//example-order",
"created_at": "2018-02-22T00:00:00Z",
"cancellation_reason": "delivery_driven",
"locale": "en_US",
"fulfillment_details": {
"window_starts_at": "2018-02-22T00:00:00Z",
"window_ends_at": "2018-02-22T00:30:00Z"
},
"items": [
{
"line_num": "68",
"qty": 9,
"qty_unit": "each",
"replaced": false,
"scan_code": "00070481001179",
"replacement_policy": "shoppers_choice",
"item": {
"upc": "123456789077",
"rrc": "",
"requested_upc": "123456789077",
"requested_rrc": "",
"delivered_upc": "123456789077",
"delivered_rrc": ""
}
}
]
}
4XX Errors
Code | Cause | Error Message |
---|---|---|
400 | Too late to cancel order | "too_late" |
400 | Request could not be processed at this time | "The request could not be completed at this time, try again later." |
400 | Invalid user id | "User Not Found" |
403 | Inactive user | "User Not Active" |
404 | Order not found | "Resource not found" |