Rewards API
Rewards connector that enables to provide vouchers, coupons, rewards or deals for your customers.
This is a DRAFT version and is subject to changes.
This document has been created as a preliminary version to gather feedback, suggestions, and input from all parties involved.
Glossary
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 rewards are fetched to PORTOS. |
Venue | E.g. store or restaurant. |
Cashier | The Venue personnel. |
Customer | Person who purchases the goods. |
Reward | The coupon or discount that customer can be rewarded with. |
Product | The product that is being purchased by customer. |
How it works
The Rewards API is a mechanism that allows importing rewards (such as coupons, deals or discounts) to the PORTOS system.
The PORTOS system acts as an "client" initiating HTTP request targeting the external system, that acts as an "server" and handles the following requests:
Fetch available rewards
Claim reward(s)
The PORTOS system expects that responses from external system follows data format described below.
Fetch available rewards
GET
{external-system}{get-rewards-url}
The PORTOS system will fetch available rewards from the external system, by initiating GET HTTP request to the external system address. External system returns response of type CustomerRewards
, that contains the collection of rewards, that customer can be rewarded with.
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. |
customerId | string | The customer identifier. E.g. the serial number of the loyalty card, if provided by customer. |
Headers
Name | Type | Description |
---|---|---|
Accept-Language | string | Specifies the desired localization for receiving messages from the API. E.g. |
Claim reward(s)
POST
{external-system}{claim-rewards-url}
After the reward is confirmed 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 reward(s) as claimed.
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. |
Headers
Name | Type | Description |
---|---|---|
Accept-Language | string | Specifies the desired localization for receiving messages from the API. E.g. |
Request Body
Name | Type | Description |
---|---|---|
rewardIds* | string[] | Non-empty collection of claimed reward identifiers. |
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 |
---|---|---|
External system "get rewards" URL |
| The URL hosted by external system, that will be requested by PORTOS to fetch rewards. |
External system "claim rewards" URL |
| The URL hosted by external system, that will be requested by PORTOS to claim rewards. |
API key |
| The venue-specific API key (authorization token) that will be placed in the |
Data model
The rewards API data model is described below.
All prices include taxes.
CustomerRewards
The collection of rewards available for given customer.
Name | Type | Required | Description |
---|---|---|---|
|
| The collection of available rewards. | |
customer | The information about customer, if available. | ||
|
| The maximum number of applicable rewards per given purchase. |
Customer
Information about customer.
Name | Type | Required | Description |
---|---|---|---|
|
| The display name of customer or customer loyalty account. | |
|
| Represents number of loyalty points associated with customer account. | |
|
| First name. | |
|
| Last name. | |
|
| E-mail address that can be used when sending receipt in e-mail form. | |
|
| The maximum number of rewards that can be applied per purchase. The rewards can also be limited by specifying available customers loyalty points and price in points of reward. |
Reward
Represents the reward.
Name | Type | Required | Description |
---|---|---|---|
|
| Unique reward identifier. | |
|
| Reward title. | |
|
| Short reward description. | |
| Conditions that need to be fulfilled in order for the customer to claim the reward. | ||
| Collection of one or more items associated with given reward. | ||
|
| If specified, the reward becomes applicable only after the specified date and time in ISO_8601 format, expressed in UTC. | |
|
| If specified, the reward is applicable only before the specified date and time in ISO_8601 format, expressed in UTC. | |
|
| If specified, represents the minimum purchase amount required to claim the reward. | |
|
| Specifies number of loyalty points subtracted from customer's loyalty account once the reward is claimed. | |
|
| Specifies maximum number of times can this reward be claimed by any customer. | |
|
| Specifies maximum number of times can this reward be claimed by given customer. |
RewardCondition
Name | Type | Required | Description |
---|---|---|---|
| Optional conditions related to purchase. |
RewardPurchaseCondition
Name | Type | Required | Description |
---|---|---|---|
|
| If specified, represents the minimum purchase amount required to claim the reward. |
RewardItem
Single reward item.
Name | Type | Required | Description |
---|---|---|---|
|
| One of | |
| Required, when | ||
| Required, when | ||
|
| One of | |
|
| One of | |
|
| Positive, non-zero number. Minimal value is | |
|
| Positive, non-zero number, with value between |
RewardItemDiscountType
List of known discount types:
Name | Description |
---|---|
| Reward provides a percentage discount. |
| Reward provides a discount that is specified by a fixed or absolute value rather than a percentage. |
| Reward provides a discount by subtracting a specific value from the original retail price of a product or service. |
RewardItemTarget
The target that reward item applies to.
Name | Description |
---|---|
| Reward provides a discount to single purchase item. Purchase item can be specified by |
| Reward provides a discount for a certain product, specified by |
| Reward applies a discount to entire purchase |
RewardItemProductFilter
Model that uniquely identifies product.
Name | Type | Required | Description |
---|---|---|---|
| At least one of identifier fields ( | ||
|
| At least one of identifier fields ( |
RewardItemPurchaseItemFilter
Model that selects purchase item.
Name | Type | Required | Description |
---|---|---|---|
|
|
| |
|
|
| |
|
| If specified, | |
|
| If specified, | |
|
| If specified, | |
|
| If specified, |
PurchaseItemLookupMode
Specifies, what strategy is used to look up single purchase item among all items in purchase, that reward will be applied to.
Name | Description |
---|---|
| Prefers least expensive product, based on it's unit price. |
| Prefers most expensive product, based on it's unit price. |
Error models
Error
Error model received for non-2XX HTTP statuses.
Name | Type | Required | Description |
---|---|---|---|
|
| Human readable message describing the error. | |
|
| Id of | |
|
| Available, if error matches one of known error codes. |
ErrorCode
The third-party server can return an Error
with one of the following codes:
Error code | Description |
---|---|
| Should be used when PORTOS attempts to fetch rewards without providing loyalty card id, but loyalty card is required by the third-party server. |
| Customer loyalty card is not recognized. |
| Reward is not found. |
| Reward is currently not available. E.g. current date and time does not match with |
| The reward usage limit has been exceeded. |
| The reward usage limit has been exceeded for the specified customer. |
| The customer lacks sufficient loyalty points to claim the reward. |
Versioning
This API uses semantic versioning. Given a version number MAJOR.MINOR
, increment the:
MAJOR version: incompatible API changes are introduced.
MINOR version: functionality is added in a backward compatible manner.
Changelog
Version 1.0-beta.2 (2023-05-29)
Added:
Accept-Language header added to HTTP requests.
Changed:
RewardRule
renamed toRewardCondition
.
Version 1.0-beta.1 (2023-05-26)
Initial version.
Last updated