Subscribing to business order events

Subscribe to order events for a given business

You can subscribe to ordering events for a given business by creating notifications against a business. When we send the order to POS we will send the result to the notifications you have created.

We currently only support webhooks, where we will POST a JSON payload to the provided http URI.

Webhooks

To create a webhook for receiving notifications about all orders from a particular business

// POST /ordering/v3/business/{businessId}/notifications
{
    "type": "webhook",
    "uri": "https://yourdomain.com/path/to/webhook/for/orders"
}

The response in case of a successful response is:

SUCCESS: 201 Created
// no body

or for failure:

FAILURE: 400 Bad Request
{
    "message": string
}
FAILURE: 403 Not Authorised
{
    "message": string
}

Ordering events and notifications content

There are 3 types of ordering events:

  • Ready - the order is created
  • Sent to POS - the order is sent to pos
  • Failed to send to POS - sending the order to pos is failed

"Ready" notification payload structure

// POST to <customer configured endpoint>
{
    "type": "BUSINESS_READY",
    "timestamp": "2017-03-14T14:59:40+00:00",
    "data": {
              "generatedAt": "2018-11-15T11:01:00+00:00",
              "orderId": "b3dbf98e-3c10-4823-b784-21025ab1f072",
              "createdAt": "2018-11-15T11:01:00+00:00",
              "status": "ready",
              "total": {
                  "amount": 2490,
                  "currency": "GBP"
              },
              "location": {
                  "id": 3405,
                  "name": "Location Name",
                  "reference": "N234"
              },
              "fulfilment": {
                  "collectionTime": "time the customer will collect the order",
                  "collectionNotes": "notes specified by the customer for collection",
                  "name": "name of the customer",
                  "phone": "phone number of the customer",
                  "orderReference": "reference number used to collect the order. used by the restaurant to know which order to give to the customer. will show up in the receipt",
                  "kitchenNotes": "notes specified by the customer for the kitchen"
              },
              "items": [
                  {
                      "uuid": "370781d3-665c-554d-95f8-5360d2463a5b",
                      "name": "item name",
                      "price": {
                          "amount": 370,
                          "currency": "GBP"
                      },
                      "modifiers": [
                          {
                              "uuid": "dcb44406-72cb-460d-86b5-0dd04e387e93",
                              "name": "modifier name",
                              "options": [
                                  {
                                      "uuid": "acb9216e-890b-4c5b-bcb8-8c958b30ca65",
                                      "name": "option name",
                                      "price": {
                                           "amount": 370 ,
                                           "currency": "GBP"
                                       }
                                   }
                              ]
                          }
                      ]
                  }
              ],
              "payments": [
                  {
                      "hash": "iweuri2u3rjhasghjg23876ikjes",
                      "createdAt": "2018-11-15T11:01:00+00:00",
                      "status": "created, auth, charged",
                      "authCode": "12312asdasd",
                      "last4Digits": "1234",
                      "amount": 3000
                  }
              ]
            }
}

"Sent to pos" notification payload structure

// POST to <customer configured endpoint>
{
    "type": "BUSINESS_SENT_TO_POS",
    "timestamp": "2017-03-14T14:59:40+00:00",
    "data": {
              "generatedAt": "2018-11-15T11:01:00+00:00",
              "orderId": "b3dbf98e-3c10-4823-b784-21025ab1f072",
              "createdAt": "2018-11-15T11:01:00+00:00",
              "status": "sent to pos",
              "total": {
                  "amount": 2490,
                  "currency": "GBP"
              },
              "location": {
                  "id": 3405,
                  "name": "Location Name",
                  "reference": "N234"
              },
              "fulfilment": {
                  "collectionTime": "time the customer will collect the order",
                  "collectionNotes": "notes specified by the customer for collection",
                  "name": "name of the customer",
                  "phone": "phone number of the customer",
                  "orderReference": "reference number used to collect the order. used by the restaurant to know which order to give to the customer. will show up in the receipt",
                  "kitchenNotes": "notes specified by the customer for the kitchen"
              },
              "items": [
                  {
                      "uuid": "370781d3-665c-554d-95f8-5360d2463a5b",
                      "name": "item name",
                      "price": {
                          "amount": 370,
                          "currency": "GBP"
                      },
                      "modifiers": [
                          {
                              "uuid": "dcb44406-72cb-460d-86b5-0dd04e387e93",
                              "name": "modifier name",
                              "options": [
                                  {
                                      "uuid": "acb9216e-890b-4c5b-bcb8-8c958b30ca65",
                                      "name": "option name",
                                      "price": {
                                           "amount": 370 ,
                                           "currency": "GBP"
                                       }
                                   }
                              ]
                          }
                      ]
                  }
              ],
              "payments": [
                  {
                      "hash": "iweuri2u3rjhasghjg23876ikjes",
                      "createdAt": "2018-11-15T11:01:00+00:00",
                      "status": "created, auth, charged",
                      "authCode": "12312asdasd",
                      "last4Digits": "1234",
                      "amount": 3000
                  }
              ]
            }
}

"Failed to send to pos" notification payload structure

// POST to <customer configured endpoint>
{
    "type": "BUSINESS_FAILED_TO_SEND_TO_POS",
    "timestamp": "2017-03-14T14:59:40+00:00",
    "data": {
              "generatedAt": "2018-11-15T11:01:00+00:00",
              "orderId": "b3dbf98e-3c10-4823-b784-21025ab1f072",
              "createdAt": "2018-11-15T11:01:00+00:00",
              "status": "failed to send to pos",
              "total": {
                  "amount": 2490,
                  "currency": "GBP"
              },
              "location": {
                  "id": 3405,
                  "name": "Location Name",
                  "reference": "N234"
              },
              "fulfilment": {
                  "collectionTime": "time the customer will collect the order",
                  "collectionNotes": "notes specified by the customer for collection",
                  "name": "name of the customer",
                  "phone": "phone number of the customer",
                  "orderReference": "reference number used to collect the order. used by the restaurant to know which order to give to the customer. will show up in the receipt",
                  "kitchenNotes": "notes specified by the customer for the kitchen"
              },
              "items": [
                  {
                      "uuid": "370781d3-665c-554d-95f8-5360d2463a5b",
                      "name": "item name",
                      "price": {
                          "amount": 370,
                          "currency": "GBP"
                      },
                      "modifiers": [
                          {
                              "uuid": "dcb44406-72cb-460d-86b5-0dd04e387e93",
                              "name": "modifier name",
                              "options": [
                                  {
                                      "uuid": "acb9216e-890b-4c5b-bcb8-8c958b30ca65",
                                      "name": "option name",
                                      "price": {
                                           "amount": 370 ,
                                           "currency": "GBP"
                                       }
                                   }
                              ]
                          }
                      ]
                  }
              ],
              "payments": [
                  {
                      "hash": "iweuri2u3rjhasghjg23876ikjes",
                      "createdAt": "2018-11-15T11:01:00+00:00",
                      "status": "created, auth, charged",
                      "authCode": "12312asdasd",
                      "last4Digits": "1234",
                      "amount": 3000
                  }
              ]
            }
}