Cancel Order
The "Cancel Order" API allows you to cancel an order. This feature enhances user experience by providing a simple way to cancel orders.
Endpoint
api/customer/orders/cancel/{id}
Http Method:
POST
URL Parameters:
id
(required): The unique identifier of the order. For guest orders, this will be a UUID, and for authenticated customer orders.
If the user is logged in, they should send the ID of the order they want to cancel. If the user is a guest, they should send the UUID of the order for identification.
Request Body:
cancellation_id
: The ID of the cancellation reason. Retrieve this ID from the Get Order Cancellation Reasons API.cancellation_text
(optional): The text of the cancellation reason.
Success Response:
Check the following section to learn more about the Order Details Resource.
{
"code": 200,
"message": "Success",
"data": {
"id": 66777,
"uuid": "2161d544-ed3e-4771-b853-7e3bae3a2bb5",
"state": {
"id": 1,
"name": "placed",
"name_ar": "تم الطلب"
},
"cancellation_id": null,
"cancellation_reason": null,
"investigation_text": null,
"cancellation_text": null,
//...
}
}
Check the following section to learn more about the Order Details API Reference
Get Order Cancellation Reasons
The "Get Order Cancellation Reasons" API allows you to retrieve a list of reasons that users can select when canceling an order. This feature enhances user experience by providing clear and predefined options for canceling orders.
Endpoint
api/customer/order_cancellation_reasons
Http Method:
GET
Success Response:
Key | Type | Description |
---|---|---|
id | Integer | The ID of the cancellation reason. |
text | String | The title of the cancellation reason. |
{
"code": 200,
"message": "Success",
"data": [
{
"id": 1,
"text": "Ordered by mistake"
},
{
"id": 5,
"text": "Find a better offer elsewhere"
},
{
"id": 6,
"text": "Shipping Delay"
},
{
"id": 7,
"text": "Changed my opinion"
},
{
"id": 8,
"text": "Other"
}
],
"meta": []
}
Check the following section to learn more about the Order Cancellation Reasons API Reference