Cancel Order
POST {{BASE_HABITAT_URL}}/api/orders/2f3385e0-981e-11ed-954d-c32dcb0a5fb2/cancel
Required scope: orders:write
Cancel an order before it has been fulfilled. If you are using our DSP Fleet network, orders can only be cancelled before the driver has picked up the food.
Refund reasons, listed below, are often used in the case of a refund request with a DSP. You don’t need to support every single case, but best practice would be to support every one you can.
| Reason | Description |
|---|---|
| CustomerCancelled | Customer has requested to cancel because they no longer want the order. |
| CustomerChangedOrder | Customer has revised their order contents and a new order is created, Customer has revised their order from delivery to pickup, etc. |
| MissedDropoffTime | Customer cancels because the delivery is delayed and still has not arrived. |
| CustomerOtherReason | A customer reason other than what has been defined. |
| DriverMissedPickup | The vendor is cancelling because the driver is delayed in arriving to pickup the order for delivery. |
| SystemFailure | Order processing failures, such as: POS transmission failures, payment gateway failures, etc. |
| UnableToFulfill | Vendor is unable to make or fulfill the order(e.g.out of stock, emergency shutdown of store for the day, etc.). |
| VendorOtherReason | A vendor reason other than what has been defined. |
| PickupNotReady | The driver has arrived but the vendor is not ready for the driver to pick up the order. |
| DestinationUnreachable | The driver is unable to reach the customer to complete the delivery. |
| PackageContents | The driver is able to reach the customer, but the customer has refused acceptance of the delivery.There were missing or wrong items in the delivery package. |
| PackageDamage | The driver is able to reach the customer, but the customer has refused acceptance of the delivery.The delivery package was damaged by the time it arrived to the customer destination. |
| DriverFailure | Driver has the order but their delivery mode has failed(e.g.car mechanical issues, bicycle tire is flat, etc.). |
| ServiceOverCommitted | The delivery provider has accepted the delivery request but now does not have sufficient drivers to assign to the delivery. |
| DspOtherReason | A delivery provider reason other than what has been defined. |
Request body
Section titled “Request body”{ "reason": "DestinationUnreachable", "reasonComments": "Driver called and rang, no response after 5 minutes"}Examples
Section titled “Examples”curl --request POST '${BASE_HABITAT_URL}/api/orders/2f3385e0-981e-11ed-954d-c32dcb0a5fb2/cancel' \ --header 'Content-Type: application/json' \ --data '{ "reason": "DestinationUnreachable", "reasonComments": "Driver called and rang, no response after 5 minutes"}'const response = await fetch("${BASE_HABITAT_URL}/api/orders/2f3385e0-981e-11ed-954d-c32dcb0a5fb2/cancel", { "method": "POST", "headers": { "Content-Type": "application/json" }, "body": "{\n\t\"reason\": \"DestinationUnreachable\",\n\t\"reasonComments\": \"Driver called and rang, no response after 5 minutes\"\n}"})const data = await response.json()import requests
response = requests.request( "POST", "${BASE_HABITAT_URL}/api/orders/2f3385e0-981e-11ed-954d-c32dcb0a5fb2/cancel", headers={ 'Content-Type': 'application/json'}, data="{\n\t\"reason\": \"DestinationUnreachable\",\n\t\"reasonComments\": \"Driver called and rang, no response after 5 minutes\"\n}",)response.raise_for_status()Saved responses
Section titled “Saved responses”{ "type": "success", "data": { "order_id": "a944dbc0-ca75-11ed-8f65-cfb250471e45", "reason": "DestinationUnreachable", "reason_comments": "Driver called and rang, no response after 5 minutes" }}
