# Food Ordering API

This is the API for POSes looking to implement food ordering on Tyro Connect

Version: 1.0

## Servers

Production
```
https://api.tyro.com/connect
```

## Security

### JWT

Type: openIdConnect
OpenID Connect URL: https://auth.connect.tyro.com/.well-known/openid-configuration

## Download OpenAPI description

[Food Ordering API](https://docs.connect.tyro.com/_bundle/pos/apis/ordering/1.0/index.yaml)

## Other

### Get Order

 - [GET /orders/{id}](https://docs.connect.tyro.com/pos/apis/ordering/1.0/other/get-order.md): This endpoint is used to fetch the details of an order. It can be used when a new webhook event is received. It can also be used to fetch the order at a later date if required.
> Note:
> For the best end user experience, we recommend to include the following fields when showing the order to the user (eg. on a docket, bump screen):
  > - origin.name - this displays the name of the App the order originated from,
  > - origin.orderReference - this displays the order reference that allows its easy identification,
  > - customers.firstName - this displays the name of the customer.
> Please keep in mind that those fields do not have restrictions on length and might need to be handled appropriately on your end to be displayed correctly to the end user.

### Update Order

 - [PATCH /orders/{id}](https://docs.connect.tyro.com/pos/apis/ordering/1.0/other/update-order.md): There are two kinds of status updates that you can send to Tyro Connect to indicate how the order is progressing: mandatory status updates (that allow us to track order properly) and optional status updates (that will positively impact user experience if the connected App can handle such status update).

The mandatory status updates that you must send to indicate if the POS was able to successfully handle the order are:
 - ACCEPTED - POS accepted the order and it will be fulfilled.
 - REJECTED - POS failed to handle the order and the order will not be fulfilled.
 - READY - The order is ready to be picked up by the customer.

Orders that stay in the CREATED state for longer than two minutes will be automatically rejected and no further update is possible.

The optional status updates are:
 - BEING_PREPARED - order is being prepared
 - OUT_FOR_DELIVERY - order was dispatched for delivery (where applicable)
 - FULFILLED - The order has been picked up by the customer and is fulfilled (this will not apply if the order was dispatched for delivery).
 - CANCELLED_BY_MERCHANT - the merchant cancelled the order and it will not be fulfilled
 - CANCELLED_BY_CUSTOMER - customer contacted merchant and cancelled the order

