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
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
version*
string
The version of the exchange protocol. For versions 1.X, value is set to 1
.
key*
string
The API key.
customerId
string
The customer identifier. E.g. the serial number of the loyalty card, if provided by customer.
Headers
Accept-Language
string
Specifies the desired localization for receiving messages from the API. E.g. sk-SK
.
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
version*
string
The version of the exchange protocol. For versions 1.X, value is set to 1
.
key*
string
The API key.
Headers
Accept-Language
string
Specifies the desired localization for receiving messages from the API. E.g. sk-SK
.
Request Body
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.
External system "get rewards" URL
string
The URL hosted by external system, that will be requested by PORTOS to fetch rewards.
External system "claim rewards" URL
string
The URL hosted by external system, that will be requested by PORTOS to claim rewards.
API key
string
The venue-specific API key (authorization token) that will be placed in the key
query parameter of all HTTP requests.
Data model
The rewards API data model is described below.
All prices include taxes.
CustomerRewards
The collection of rewards available for given customer.
rewards
The collection of available rewards.
customer
The information about customer, if available.
maxApplicableRewards
int
The maximum number of applicable rewards per given purchase.
Customer
Information about customer.
displayName
string
The display name of customer or customer loyalty account.
points
number
Represents number of loyalty points associated with customer account.
firstName
string
First name.
lastName
string
Last name.
email
string
E-mail address that can be used when sending receipt in e-mail form.
maxApplicableRewards
int
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.
id
string
Unique reward identifier.
title
string
Reward title.
description
string
Short reward description.
conditions
Conditions that need to be fulfilled in order for the customer to claim the reward.
items
Collection of one or more items associated with given reward.
activationDate
string
If specified, the reward becomes applicable only after the specified date and time in ISO_8601 format, expressed in UTC.
expirationDate
string
If specified, the reward is applicable only before the specified date and time in ISO_8601 format, expressed in UTC.
minPurchaseAmountIncludingVat
number
If specified, represents the minimum purchase amount required to claim the reward.
priceInPoints
number
Specifies number of loyalty points subtracted from customer's loyalty account once the reward is claimed.
remainingUsage
number
Specifies maximum number of times can this reward be claimed by any customer.
remainingCustomerUsage
number
Specifies maximum number of times can this reward be claimed by given customer.
RewardCondition
purchase
Optional conditions related to purchase.
RewardPurchaseCondition
minAmountIncludingVat
number
If specified, represents the minimum purchase amount required to claim the reward.
RewardItem
Single reward item.
target
string
productFilter
Required, when target
is product
. Must be null otherwise.
purchaseItemFilter
Required, when target
is purchaseItem
. Must be null otherwise.
purchaseItemLookupMode
string
One of PurchaseItemLookupMode.
when target
is purchaseItem
. Must be null otherwise.
discountType
string
discountAmount
number
Positive, non-zero number. Minimal value is 0.01
. Required, when discountType
is absolute
or relative
. Must be null otherwise.
discountRate
number
Positive, non-zero number, with value between 0.01
and 100
. Required, when discountType
is percentage
. Must be null otherwise.
RewardItemDiscountType
List of known discount types:
percentage
Reward provides a percentage discount.
absolute
Reward provides a discount that is specified by a fixed or absolute value rather than a percentage.
relative
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.
purchaseItem
product
purchase
Reward applies a discount to entire purchase
RewardItemProductFilter
Model that uniquely identifies product.
pluId
At least one of identifier fields (pluId
or id
) must be specified.
id
string
At least one of identifier fields (pluId
or id
) must be specified.
RewardItemPurchaseItemFilter
Model that selects purchase item.
pluIds
TicketItem.Plu.Code
and TicketItem.Plu.StockName
must be equal to one of provided values, if value is not null or empty.
articleCategoryLabels
string[]
TicketItem.Plu.ArticleCategoryLabel
must be equal to one of provided values, if value is not null or empty.
minUnitPriceIncludingVat
number
If specified, TicketItem.UnitPriceIncludingVat
must be greater than or equal to provided value.
maxUnitPriceIncludingVat
number
If specified, TicketItem.UnitPriceIncludingVat
must be less than or equal to provided value.
minQuantity
number
If specified, TicketItem.Quantity
must be greater than or equal to provided value.
maxQuantity
number
If specified, TicketItem.Quantity
must be less than or equal to provided value.
PurchaseItemLookupMode
Specifies, what strategy is used to look up single purchase item among all items in purchase, that reward will be applied to.
cheapest
Prefers least expensive product, based on it's unit price.
mostExpensive
Prefers most expensive product, based on it's unit price.
Error models
Error
Error model received for non-2XX HTTP statuses.
message
string
Human readable message describing the error.
rewardId
string
code
string
ErrorCode
The third-party server can return an Error
with one of the following codes:
CUSTOMER_ID_REQUIRED
Should be used when PORTOS attempts to fetch rewards without providing loyalty card id, but loyalty card is required by the third-party server.
UNKNOWN_CUSTOMER_ID
Customer loyalty card is not recognized.
REWARD_NOT_FOUND
Reward is not found.
REWARD_NOT_AVAILABLE
REWARD_USAGE_LIMIT_EXCEEDED
The reward usage limit has been exceeded.
REWARD_CUSTOMER_USAGE_LIMIT_EXCEEDED
The reward usage limit has been exceeded for the specified customer.
INSSUFICIENT_LOYALTY_POINTS
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