# Update order

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).

App only may send:
 - CANCELLED_BY_CUSTOMER - customer has cancelled the order.
 - FULFILLED - The order was completed successfully.

POS only may send, as mandatory status updates that indicate whether the POS was able to successfully handle the order:
 - 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 POS may also optionally send:
 - 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

Endpoint: PATCH /orders/{orderId}
Version: 1.0
Security: JWT

## Header parameters:

  - `Authorization` (string, required)

## Path parameters:

  - `orderId` (string, required)
    Identifier of the order that needs to be updated

## Request fields (application/merge-patch+json):

  - `status` (string, required)
    Enum: "ACCEPTED", "REJECTED", "BEING_PREPARED", "READY", "OUT_FOR_DELIVERY", "CANCELLED_BY_MERCHANT", "CANCELLED_BY_CUSTOMER", "FULFILLED"

  - `reason` (string)
    Required only when status is REJECTED, CANCELLED_BY_MERCHANT or CANCELLED_BY_CUSTOMER. An empty string will be considered as invalid

## Response 400 fields (application/json):

  - `message` (string)
    General error message

  - `errors` (array)
    List of errors for further information about the error

  - `errors.segment` (string)
    Location in the request where the error occured

  - `errors.path` (string)
    Path of where the error occurred

  - `errors.message` (string)
    Error message

  - `error` (string)
    Error message

## Response 409 fields (application/json):

  - `error` (string)
    Error message


## Response 204 fields

## Response 401 fields

## Response 403 fields

## Response 404 fields

## Response 500 fields
