Important |
To use the |
You can use the orders API to update the following delivery information:
-
deliveryState
- The current status of the delivery. -
deliveryEmployee
- The employee who makes the delivery (requires additional permissions). -
dispatchedDate
- When the order was dispatched. -
deliveredDate
- When the order was delivered.
The delivery location values (for example, street address and city) and the delivery notes value cannot be updated.
To update delivery information, you send a
PATCH
request to the
/orders/
endpoint of the orders API. The request must include a JSON
{orderGuid}
/deliveryInfoDeliveryInfo
object that provides the updated values.
For more information about the endpoint used in this process, see the /deliveryInfo reference guide.
To update the delivery information for an existing order
-
Locate the Toast platform GUID for the order you are updating. For more information on locating an order GUID see Finding an order or check GUID.
-
If you plan to update an order's
deliveryEmployee
field, locate the Toast platform GUID of the employee to assign as the delivery driver. For information on retrieving employee details, see Getting all employees of a restaurant. -
Create a JSON
DeliveryInfo
object that contains the delivery information you want to update.You can update any of the following values and only need to include the values you are updating.
dispatchedDate
-
The date and time when the restaurant indicated the order was available for delivery and assigned to the delivery employee.
For more information on formatting dates and times, see Dates and timestamps.
deliveredDate
-
The date and time when the delivery employee indicated the order was delivered.
For more information on formatting dates and times, see Dates and timestamps.
deliveryState
-
The status of the delivery order. The available values for
deliveryState
are:-
PENDING
- The delivery order is not dispatched. Corresponds to the Unassigned tab for deliveries on the Toast POS application. -
PICKED_UP
- The delivery employee has picked up the order from the restaurant. -
IN_PROGRESS
- The order is on its way to the destination. Corresponds to the En Route tab for deliveries on the Toast POS application. -
DELIVERED
- The order was delivered. Corresponds to the Delivered tab for deliveries on the Toast POS application.
A typical order's
deliveryState
transitions fromPENDING
toPICKED_UP
toIN_PROGRESS
toDELIVERED
. However, you might change thedeliveryState
to a previous value to correct an error. For example, the delivery employee marks the wrong order asDELIVERED
and needs to revert it toIN_PROGRESS
. -
deliveryEmployee
-
Contains the Toast platform GUID of the employee assigned as the delivery driver.
The delivery location values (for example, street address and city) and the delivery notes value cannot be updated.
For an example
DeliveryInfo
object, see Example DeliveryInfo object. -
Send a
PATCH
request to the/orders/
endpoint of the orders API.{orderGuid}
/deliveryInfoIn the
PATCH
path, include the Toast platform GUID of the order.In the body of the request, include the
DeliveryInfo
object with the delivery information you want to update. -
Examine the response data you receive from the orders API. Verify your request is processed successfully with a 200 HTTP code response.
The response contains the full
Order
object. For an example, see this response.
The following example shows the DeliveryInfo
object for
updating delivery information for an order.
{ "deliveredDate": "2021-09-14T17:57:42.263+0000", "dispatchedDate": "2021-09-14T17:57:42.263+0000", "deliveryState": "DELIVERED", "deliveryEmployee": { "guid": "e10f2ae0-9690-4ab2-86fe-fa6603d708d0" } }
The date and time when the delivery employee indicated the order was delivered. |
|
The date and time the restaurant indicated the order was available for delivery and was assigned to a delivery employee. |
|
The state of a delivery order. The possible values are
|
|
The Toast platform GUID of the delivery employee at the restaurant. |
The following example shows the response for a PATCH
request to the
/orders/
endpoint of the orders API.
{orderGuid}
/deliveryInfo
{ "guid": "d16ceaeb-d8a3-4d47-82db-0199d37c0713", "entityType": "Order", [contents omitted] "deliveryInfo": { "address1": "401 Park Drive", "address2": "Suite 801", "city": "Boston", "state": "MA", "zipCode": "02215", "latitude": 42.3446671, "longitude": -71.1023575, "notes": "", "deliveredDate": "2021-09-14T17:57:42.263+0000", "dispatchedDate": "2021-09-14T17:57:42.263+0000", "deliveryEmployee": { "guid": "e10f2ae0-9690-4ab2-86fe-fa6603d708d0", "entityType": "RestaurantUser", "externalId": null }, "deliveryState": "DELIVERED" }, [contents omitted] "diningOption": { "guid": "f6cd5b58-27d7-462a-922f-7f919a6f9137", "entityType": "DiningOption", "externalId": null }, [contents omitted] }
The following image shows an order on the Unassigned tab of the Delivery screen on a Toast POS device.
The following image shows the order on the
Delivered tab after a PATCH
request
changed the order status to DELIVERED
and added a delivery
employee.