Online orders API
Transporting orders from e-shops or food delivery platforms to the PORTOS application.
Glossary
Term | Definition |
---|---|
Term | Definition |
PORTOS | The cash register solution developed by Nine Digit, s.r.o. |
External system | The 3rd party system (such as e-shop or food delivery platform) from which unprocessed orders are imported to PORTOS. |
Venue | The restaurant processing the order. |
Cashier | The Venue personnel |
Customer | User who orders the goods trough external system. |
Order | The purchase request made by customer trough the external system, containing data about products, delivery address, etc. |
Unprocessed order | Order accepted by external system, but not yet confirmed nor rejected by PORTOS. |
Processed order | Order confirmed or rejected by PORTOS. |
Product | The product (such as food or drink) that is ordered by customer. |
How it works
The online orders API is a mechanism that allows importing online orders from "external system" (such as e-shops or food delivery platforms) to the PORTOS system.
The PORTOS system acts as an "client" initiating HTTP requests targeting the external system, that acts as an "server" and handles the following requests:
Fetch unprocessed orders
Process order
After unprocessed order is fetched, cashier is requested to process (either accept or reject) the order trough the PORTOS application. After cashier confirms or rejects the order, PORTOS application will initiate second request (process order) to the external system.
The PORTOS system expects that responses from external system follows data format described below.
Fetch unprocessed orders
GET
{external-system}{unprocessed-orders-url}
The PORTOS system will periodically fetch the unprocessed orders from the external system, by initiating GET HTTP request to the external system. External system returns the unprocessed orders for given venue. If the collection of orders is paginated by the external system (so response does not contain all unprocessed orders), the most oldest orders should be returned.
Query Parameters
Name | Type | Description |
---|---|---|
version | string | The version of the exchange protocol. For versions 1.X, value is set to |
key | string | The API key. |
Process order
POST
{external-system}{process-order-url}
After the order is confirmed or rejected by Cashier trough the PORTOS cash register system user interface, the PORTOS system will initiate the POST HTTP request to the external system, to mark this specific order as processed.
Query Parameters
Name | Type | Description |
---|---|---|
version | string | The version of the exchange protocol. For versions 1.X, value is set to |
key | string | The API key. |
externalId | string | The external identifier of the order |
status | string | The order processing result. May be one of following: |
estimatedCompletionAt | string | The estimated date and time of order completion, formatted in ISO_8601 format.
The meaning may vary based on order type:
- If order type is |
rejectionReason | string | Briefly described reason of the rejection. Is optionally provided only when the status is |
Data model
The data model of online orders exchange is described below.
All prices include taxes.
Order
Order represents purchase request made by customer trough the external system, containing data about products, delivery address, etc.
Name | Type | Required | Description |
---|---|---|---|
|
| The unique identifier of order, generated by the external system. | |
|
| The type of order. Contains one of following values: | |
| Information about the order delivery. Required, when | ||
|
| The ISO_8601 formatted date and time of order creation (when the order has been created in external system). | |
|
| The optional ISO_8601 formatted date and time of scheduled order. If not specified, order should be delivered ASAP. This field is required when order type is | |
| Customer contact information. | ||
| The collection of products. Must contain at least one product. | ||
|
| Currency code (in ISO 4217 standard) for order price information. | |
| The information about payment. | ||
|
| Wrapping fee (not applicable in Slovak republic due to Slovak legislation). | |
|
| Packaging deposit (associated with 0% TAX rate) | |
|
| Tip | |
|
| Total price of order, including all products, product additions, delivery and wrapping fee. Precision up to 2 decimal places. | |
|
| Optional comment related to the order. |
OrderDelivery
Order delivery information.
Name | Type | Required | Description |
---|---|---|---|
| The delivery address. | ||
|
| The cost of delivery. Precision up to 2 decimal places. If not specified, zero value will be used. |
Address
The customer's address.
Name | Type | Required | Description |
---|---|---|---|
|
| 1st line of delivery address (e.g. street name, building number) | |
|
| Optional 2nd line of delivery address. | |
|
| Name of the city. | |
|
| The ZIP code (postal code). | |
| string | Optional comment related to the address or delivery. |
Customer
The customer's contact information.
Name | Type | Required | Description |
---|---|---|---|
Name | Type | Required | Description |
|
| Yes | Name of customer. |
|
| Yes | Phone number. |
|
| No | E-mail address. |
Product
The product (such as food or drink).
Name | Type | Required | Description |
---|---|---|---|
|
| The product identifier in PORTOS system. If this field will not be provided, the processing of order will not affect stock quantity of the material in PORTOS stock management system. | |
|
| Name of product. | |
|
| Positive, non-zero integer quantity of the product (e.g. 1, 2, ...). | |
|
| The base unit price of product (product additions are not included). | |
|
| The optional product-related comment, provided by customer. | |
| The product additions (modifiers). If product Example #1: if customer orders two burgers with fries for each burger, order will contain product with name "Burger", quantity equal to 2 and addition with name "Fires" and quantity equal to one. Example #2: if customer orders two burgers, one with fries and second with salad. In this case, order will contain two separate products - first with quantity equal to one and fries in additions; second with quantity equal to one and salad in additions. |
ProductAddition
The product addition (option, modifier) that adds more information about how the product should be prepared.
Name | Type | Required | Description |
---|---|---|---|
Name | Type | Description | |
|
| The product identifier in PORTOS system. If this field will not be provided, the processing of order will not affect stock quantity of the material in PORTOS stock management system. | |
|
| Name of product. | |
|
| Positive, non-zero integer quantity of the product option (e.g. 1, 2, ...). | |
|
| The unit price of product option. Value may be positive or negative, if affects the price of product. Value also may be equal to zero, if product price is not affected (e.g. steak doeness). | |
|
| The optional attribute-related comment, provided by customer. |
Payment
The product payment information.
Name | Type | Required | Description |
---|---|---|---|
|
|
| |
|
| One of following: The description of payment method that was used (when |
Configuration
To communicate with external system properly, the external system administrators must provide values stated below to the venue owners or PORTOS support.
Value | Type | Description |
---|---|---|
Value | Type | Description |
External system unprocessed orders URL |
| The URL hosted by external system, that will be requested by PORTOS to fetch the unprocessed orders. |
External system process order URL |
| The URL hosted by external system, that will be requested by PORTOS to process (confirm or reject) order. |
API key |
| The venue-specific API key (authorization token) that will be placed in the |
Fetch period |
| The period (in seconds) that specifies, how often will PORTOS system invoke the "fetch unprocessed orders" API call. Default value is |
Example
In all request examples below, we will assume following configuration:
external system unprocessed orders URL:
https://the-foo-bar.sk/unprocessed_orders
external system process order URL:
https://the-foo-bar.sk/process_order
API key is:
my-token
Step 1: Fetching unprocessed orders
The PORTOS will request following URL:
The external system returns following payload as an response:
As we can see, the external systems returns two unprocessed orders.
Step 2: Order acceptation
The PORTOS will mark first order as accepted by requesting following URL:
Please note that all query parameters are URL encoded. In URL above, the estimatedCompletionAt
query parameter value 2021-02-01T13:01:00.000Z
is URL encoded as 2021-02-01T13%3A01%3A00.000Z
.
Step 3: Fetching unprocessed orders
The PORTOS will request unprocessed requests again:
The external system returns following payload as an response:
The recently accepted order no longer appears in unprocessed orders collection.
Step 4: Order rejection
The PORTOS will mark remaining order as rejected by requesting following URL:
Please note that all query parameters are URL encoded. In URL above, the rejectionReason
query parameter value The food is out of stock.
is URL encoded as The%20food%20is%20out%20of%20stock.
.
Step 5: Fetching unprocessed orders
The PORTOS will request unprocessed requests again:
All requests has been processed (rejected or accepted). The external system returns empty collection as an response.
Changelog
Version 1.3 (2022-12-07)
New
packagingDeposit
field added.Supported in PORTOS Pokladลa version 4.0.25 or later.
Supported in PORTOS Online Objednรกvky version 3.3.8 or later.
Version 1.2 (2022-08-12)
New
tip
field added.Supported in PORTOS Pokladลa version 4.0.9 or later.
Version 1.1 (2022-03-17)
New
note
field added.Supported in PORTOS Online Objednรกvky version 1.0.15 or later.
Version 1.0
Initial version
Last updated