# New order

App only.

This endpoint is for creating an order that Tyro Connect will deliver to a POS.

 Make sure you create the order in one of the following statuses:
 - CREATED - the order has been created but not approved by the merchant.
 - ACCEPTED - the order has already been approved by the merchant (eg. via a separate app available to them).

Making identical requests with the same orderId and content does not create a new order. In this case, it returns the previously created order's details.
This means every new order must have a different orderId.

Endpoint: POST /orders
Version: 1.0
Security: JWT

## Header parameters:

  - `Authorization` (string, required)

## Request fields (application/json):

  - `origin` (object, required)
    Contains information about the food ordering partner that created the order.

  - `origin.orderId` (string, required)
    An identifier that has been generated by the origin. This can be used for reconciliation of orders in the app partner’s system.

  - `origin.orderReference` (string, required)
    Reference for the order. You should use it to facilitate the communication between the merchant and the eater during fulfillment by providing a short code that allows the order to be easily identifiable.

  - `locationId` (string, required)
    The id of the location as specified by the Tyro Connect system.

  - `status` (string, required)
    The current status of the order. When created, order status must be CREATED or ACCEPTED.
    Enum: "CREATED", "ACCEPTED", "REJECTED", "BEING_PREPARED", "READY", "OUT_FOR_DELIVERY", "CANCELLED_BY_MERCHANT", "CANCELLED_BY_CUSTOMER", "FULFILLED"

  - `notes` (string)
    A free text field with instructions from the customer to the merchant.

  - `items` (array, required)
    A list of all the items in the order.

  - `items.id` (string, required)
    An id unique to the order, representing the item within the overall order.
order, i.e. 2 of the same items will have unique ids.

  - `items.unitPrice` (object, required)
    The basic price of a single item in cents excluding discounts (if any).

  - `items.unitPrice.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `items.unitPrice.currency` (string, required)
    Enum: "AUD", "EUR", "NZD", "GBP", "USD"

  - `items.discounts` (array)
    Each entry in the discounts array will apply to each single item - it represents unit discounts (eg. if the quantity of this object is defined as 2 and the discounts array contains one $1 entry, each of the 2 items should be discounted by $1). item.total = (item.unitPrice + item.modifiersTotal - item.discounts) * item.quantity

  - `items.discounts.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `items.discounts.currency` (string, required)
    Enum: "AUD", "EUR", "NZD", "GBP", "USD"

  - `items.discounts.description` (string)
    A description of what this amount of money represents
    Example: "Tuesday Happy Hour Discount"

  - `items.modifiers` (array)
    A list of modifications to be made to the parent item. Each entry in this array will apply to each single item - it represents unit modifiers (eg. if the quantity of this object is defined as 2 and the modifiers array contains one $1 entry, each of the 2 items should be modified by $1). item.total = (item.unitPrice + item.modifiersTotal - item.discounts) * item.quantity'

  - `items.allergens` (array)
    Allergens that need to be removed from the parent item.

  - `items.allergens.description` (string)
    Fish Nuts etc

  - `items.sku` (string, required)
    Id of the item that is aligned with the ID of the item in the POS.

  - `items.description` (string, required)
    A human readable description of the item that can be used to resolve mismatches between the app and the POS.

  - `items.quantity` (integer, required)
    The number of units of this item required to fulfil the order. Please note that items with different modifiers or surcharges should be split into separate item objects.

  - `items.notes` (string)
    An instruction or message about this order item.

  - `table` (object)
    This object is optional, and if present will only have information about table and section.

  - `table.id` (string)

  - `table.section` (string)

  - `customers` (array)
    The object only has a single field firstName.

  - `customers.firstName` (string)

  - `discounts` (array)
    Each entry in the discounts array will apply to the whole order and is included in the order total value.

  - `surcharges` (array)
    Each entry in the surcharges array will apply to the whole order and is included in the order total value.

  - `total` (object, required)
    The order total is calculated as order.total = (item.unitPrice + item.modifiersTotal - item.discounts) * item.quantity + order.surcharges - order.discounts + order.tip. Please note that TyroConnect does not enforce this calculation to allow flexibility while creating an order.

  - `total.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `total.currency` (string, required)
    Enum: "AUD", "EUR", "NZD", "GBP", "USD"

  - `tip` (object)
    This value will apply to the whole order and is included in the order total value.

  - `tip.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `tip.currency` (string, required)
    Enum: "AUD", "EUR", "NZD", "GBP", "USD"

  - `fulfilment` (object, required)
    Details about how the customers expect to receive the order.

  - `fulfilment.type` (string, required)
    Type of fulfilment the customer expects
    Enum: "PICK_UP", "DINE_IN", "DELIVERY"

  - `paymentStatus` (string)
    Current payment status of the order. Can be either OPEN or CLOSED. OPEN payment status is only applicable for orders with fulfilment type of DINE_IN.

## Response 201 fields (application/json):

  - `origin` (object, required)
    Contains information about the food ordering partner that created the order.

  - `origin.orderId` (string, required)
    An identifier that has been generated by the origin. This can be used for reconciliation of orders in the app partner’s system.

  - `origin.orderReference` (string, required)
    Reference for the order. You should use it to facilitate the communication between the merchant and the eater during fulfillment by providing a short code that allows the order to be easily identifiable.

  - `origin.name` (string)
    This will be your name. It is mostly used by POS's to identify where an order came from

  - `locationId` (string, required)
    The id of the location as specified by the Tyro Connect system.

  - `status` (string, required)
    The current status of the order. When created, order status must be CREATED or ACCEPTED.
    Enum: "CREATED", "ACCEPTED", "REJECTED", "BEING_PREPARED", "READY", "OUT_FOR_DELIVERY", "CANCELLED_BY_MERCHANT", "CANCELLED_BY_CUSTOMER", "FULFILLED"

  - `notes` (string)
    A free text field with instructions from the customer to the merchant.

  - `items` (array, required)
    A list of all the items in the order.

  - `table` (object)
    This object is optional, and if present will only have information about table and section.

  - `table.id` (string)

  - `table.section` (string)

  - `customers` (array)
    The object only has a single field firstName.

  - `customers.firstName` (string)

  - `discounts` (array)
    Each entry in the discounts array will apply to the whole order and is included in the order total value.

  - `surcharges` (array)
    Each entry in the surcharges array will apply to the whole order and is included in the order total value.

  - `total` (object, required)
    The order total is calculated as order.total = (item.unitPrice + item.modifiersTotal - item.discounts) * item.quantity + order.surcharges - order.discounts + order.tip. Please note that TyroConnect does not enforce this calculation to allow flexibility while creating an order.

  - `total.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `total.currency` (string, required)
    Enum: "AUD", "EUR", "NZD", "GBP", "USD"

  - `tip` (object)
    This value will apply to the whole order and is included in the order total value.

  - `tip.amount` (integer, required)
    This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20
    Example: 12520

  - `tip.currency` (string, required)
    Enum: "AUD", "EUR", "NZD", "GBP", "USD"

  - `fulfilment` (object, required)
    Details about how the customers expect to receive the order.

  - `fulfilment.type` (string, required)
    Type of fulfilment the customer expects
    Enum: "PICK_UP", "DINE_IN", "DELIVERY"

  - `paymentStatus` (string)
    Current payment status of the order. Can be either OPEN or CLOSED. OPEN payment status is only applicable for orders with fulfilment type of DINE_IN.

  - `id` (string)
    This is the Tyro Connect system order Id. It uniquely identifies the order.


## Response 401 fields

## Response 403 fields
