Download OpenAPI specification:Download
This document is a technical description of the API for Storebox. The Storebox API is the programming interface for Storebox.
Storebox is a website, where customers’ sign up, and register various user ID’s which can be used to identify their purchases. The customer can be identified by different user ID types, including msisdn (phone number), email address and (payment) card number (PAN).
You can use the API to integrate your backend system to Storebox, enabling you to send receipts generated in your system to Storebox with information identifying your customer, thereby making the receipt available to your customers through Storebox websites. The receipt service is offered in numerous countries with local websites in the Nordic region and an international website for all other countries.
The intended audience for this documentation is technicians developing a system integration to Storebox.
The standard interface described is based on the HTTP protocol, REST web service architecture and JSON data interchange format. A basic understanding of these technologies is expected of the reader.
It is possible to identify the customers by a (payment) card inserted in the payment terminal at the POI, used in the payment transaction. It is technically possible, because the payment terminal can generate a token of the card number. This token is made using a "hashing algorithm", which is an irreversible mathematical function generating a unique token, from which the real card number cannot be extracted.
This means that storing and transmitting the token through your system does NOT require your system to be PCI-DSS compliant.
The token is transferred to the cashier system/POS as part of the transaction, you can then store this as part of the transaction with the receipt data and use this as userId when sending the receipt data to storebox.com as described below.
To support the token solution for identifying card number, the payment terminals must be equipped with special software and encryption keys from Storebox in corporation with the terminal supplier. The list of supported terminals is expanding, currently integration is possible with:
The end user signs up on the storebox.com website or Storebox app. The website is available on https://www.storebox.com and app on the following locations
The standard receipt format is JSON as defined in the documentation. The format can contain an embedded PDF, but structured data is still required to display the receipt in a uniform format on the Storebox website and app.
ARTS POSLog version 6.0 is supported by the POS API.
To use ARTS POSLog the following content type has to be set when uploading the receipt.
Content-Type: application/x.arts.poslog.v6
As explained in this document, there are different ways of identifying the end user by payment card, phone number, etc.
ARTS POSLog does not support this identification in the actual receipt data, so identification is set through a HTTP header called X-Storebox-userid
. The format is <type>=<value>
if multiple ids are provided they are separated by “;”. For example
X-Storebox-userid: pan=foobar;msisdn=4511223344
The type
and value
are explained in the receipt model.
In some situations the receipt might be available on an external service like Azure Blob Storage or AWS S3.
It is possible for the POS API to fetch the receipt from there and process that receipt.
Instead of uploading a new receipt, a receipt reference is used which has the following format
{
"provider": "<provider>",
"contentType": "<content-type>",
"params": {
"<key1>": "<value1>",
"<key2>": "<value2>"
}
}
provider
is the hosting provider. Currently only Azure Blob Storage is supported. contentType
is the content type of the stored receipt, for example if it is in ARTS POSLog. params
are specific for provider.
To use the reference format the following Content-Type
has to be set when calling receipt upload.
Content-Type: application/vnd.storebox.receipt.download+json
{
"provider": "azure",
"contentType": "application/x.arts.poslog.v6",
"params": {
"name": "20170618_213244363-110805-25926",
"uri": "https://example.blob.core.windows.net/example?sv=2015-04-05&sr=c&sig=validsignature&st=2017-06-07T09%3A24%3A30Z&se=2027-06-07T09%3A29%3A30Z&sp=rw"
}
}
In the production environment, only production tokens are created. This means that test terminals cannot be used.
The same is true for the test system where only test tokens are generated, so only test terminals work.
When using the test system, the receipts will be available on test.storebox.com. This website works as the production website, so users can be created, and payment card added.
The POS API will ignore duplicate receipts. A receipt is defined as a duplicate if the checksum is the same as an existing receipt. Changing receipt id will not make the receipt different, however added a newline will.
This allows interation to message queues that cannot guarantee single delivery.
Create a new receipt.
In the production environment, none of the receipt parameters are validated on upload. This means that a receipt may be accepted even though it is not valid. In test, basic receipt validation is done and invalid receipts will be rejected with HTTP status code 400.
required | Array of objects |
object Optional external receipt id | |
merchantId required | string Identifier of the merchant – value assigned by Storebox |
required | object |
orderDate required | string <date-time> Date and time of order including timezone information as defined by ISO8601. It is mandatory to include the offset from UTC time respecting daylight saving. |
orderNumber required | string <= 64 characters Unique number for the receipt |
salesEmployeeName | string Name of the cashier |
headerText | Array of strings[ items <= 512 characters ] Header lines which can have random data. Will be displayed in the top of the receipt. |
footerText | Array of strings[ items <= 512 characters ] Footer lines which can have random data. Will be displayed in the bottom of the receipt. |
terminalId | string <= 32 characters Number identifying the terminal attached to the point of sale |
sequenceNumber | string <= 32 characters The receipt sequence number. This may be unique in itself or as a combination of storeId, terminalId and sequence number |
object | |
object | |
required | Array of objects |
required | object |
required | Array of objects List of payment methods used in the purchase |
object |
{- "userId": [
- {
- "type": "pan",
- "value": "858040719c2160898a69e537d4fac12168b9d2ad534567e0a8f4ebb168dd8e7b"
}
], - "receiptId": {
- "type": "storebox",
- "value": "d764e8f4-a6e9-47ef-bca3-b12d280c1f87"
}, - "merchantId": "storebox",
- "store": {
- "storeName": "Storebox",
- "storeId": "2020",
- "storeRegNumber": "35406921",
- "storeAddressLine1": "Lyngbyvej 2, 2.",
- "storeAddressLine2": "C/O Innovation Hub",
- "storeZipCode": "2100",
- "storeCity": "Købehavn Ø",
- "storeCountry": "Danmark",
- "storePhone": "+45 70151151",
- "storeEmail": "support@storebox.com",
}, - "orderDate": "2019-08-24T14:15:22Z",
- "orderNumber": "12345678",
- "salesEmployeeName": "John Doe",
- "headerText": [
- "Thank you for shopping with us"
], - "footerText": [
- "You could have saved 10 kr. if you were a loyalty member",
- "Signup here https://storebox.com"
], - "terminalId": "17193CT26617792",
- "sequenceNumber": "10",
- "receiptImage": {
- "imageType": "pdf",
- "encodingType": "base64",
- "columns": 0,
- "image": "TWFuIGlz...VyZS4="
}, - "barcode": {
- "type": "interleaved2of5",
- "value": "012345678912",
- "displayValue": "01-23456-789-12"
}, - "orderLines": [
- {
- "number": "1234",
- "category": "123",
- "name": "MILK",
- "text": "Arla Organic Full fat 200ml",
- "count": 1,
- "gtin": "2388060103489",
- "itemPrice": {
- "value": 10,
- "currency": "EUR"
}, - "totalPrice": {
- "value": 10,
- "currency": "EUR"
}, - "type": "sale"
}
], - "totalOrderPrice": {
- "value": 10,
- "currency": "EUR",
- "vatRates": [
- {
- "rate": 25,
- "value": 2
}
]
}, - "payments": [
- {
- "paymentType": "paymentcard",
- "paymentTypeLabel": "DANKORT",
- "price": {
- "value": 10,
- "currency": "EUR",
- "foreignValue": 15,
- "foreignCurrency": "USD",
- "exchangeRate": "€ 1.5/$"
}, - "truncatedCardNumber": "457100XXXXXX0001",
- "transactionId": "300001116910",
- "transaction": [
- "DANKORT",
- "CONTACTLESS",
- "XXXX XXXX XXXX 0001",
- "TERM: 00123456-123456",
- "NETS A/S",
- "4611721",
- "KC1 NETS NR:0004611721",
- "ATC:00409 AED:0000000",
- "AID: A0000001214711",
- "PSAM: 1234567-000053421",
- "ARC:00 STATUS:0000",
- "AUT. KODE: 1234567",
- "REF:112233 AUTORISERET"
], - "approvalCode": "1234567",
- "cardAcceptorId": "4611721",
- "cardAcceptorTerminalId": "00123456",
- "systemTraceAuditNumber": "123456",
- "retrievalReferenceNumber": "200101110011"
}
], - "loyalty": {
- "skipProcessing": true,
- "stampCount": 3
}
}
If a receipt with receiptId
already exists, that receipt will be overwritten otherwise it will be stored as a new receipt.
receiptId required | string Issued by Create receipt in the |
required | Array of objects |
object Optional external receipt id | |
merchantId required | string Identifier of the merchant – value assigned by Storebox |
required | object |
orderDate required | string <date-time> Date and time of order including timezone information as defined by ISO8601. It is mandatory to include the offset from UTC time respecting daylight saving. |
orderNumber required | string <= 64 characters Unique number for the receipt |
salesEmployeeName | string Name of the cashier |
headerText | Array of strings[ items <= 512 characters ] Header lines which can have random data. Will be displayed in the top of the receipt. |
footerText | Array of strings[ items <= 512 characters ] Footer lines which can have random data. Will be displayed in the bottom of the receipt. |
terminalId | string <= 32 characters Number identifying the terminal attached to the point of sale |
sequenceNumber | string <= 32 characters The receipt sequence number. This may be unique in itself or as a combination of storeId, terminalId and sequence number |
object | |
object | |
required | Array of objects |
required | object |
required | Array of objects List of payment methods used in the purchase |
object |
{- "userId": [
- {
- "type": "pan",
- "value": "858040719c2160898a69e537d4fac12168b9d2ad534567e0a8f4ebb168dd8e7b"
}
], - "receiptId": {
- "type": "storebox",
- "value": "d764e8f4-a6e9-47ef-bca3-b12d280c1f87"
}, - "merchantId": "storebox",
- "store": {
- "storeName": "Storebox",
- "storeId": "2020",
- "storeRegNumber": "35406921",
- "storeAddressLine1": "Lyngbyvej 2, 2.",
- "storeAddressLine2": "C/O Innovation Hub",
- "storeZipCode": "2100",
- "storeCity": "Købehavn Ø",
- "storeCountry": "Danmark",
- "storePhone": "+45 70151151",
- "storeEmail": "support@storebox.com",
}, - "orderDate": "2019-08-24T14:15:22Z",
- "orderNumber": "12345678",
- "salesEmployeeName": "John Doe",
- "headerText": [
- "Thank you for shopping with us"
], - "footerText": [
- "You could have saved 10 kr. if you were a loyalty member",
- "Signup here https://storebox.com"
], - "terminalId": "17193CT26617792",
- "sequenceNumber": "10",
- "receiptImage": {
- "imageType": "pdf",
- "encodingType": "base64",
- "columns": 0,
- "image": "TWFuIGlz...VyZS4="
}, - "barcode": {
- "type": "interleaved2of5",
- "value": "012345678912",
- "displayValue": "01-23456-789-12"
}, - "orderLines": [
- {
- "number": "1234",
- "category": "123",
- "name": "MILK",
- "text": "Arla Organic Full fat 200ml",
- "count": 1,
- "gtin": "2388060103489",
- "itemPrice": {
- "value": 10,
- "currency": "EUR"
}, - "totalPrice": {
- "value": 10,
- "currency": "EUR"
}, - "type": "sale"
}
], - "totalOrderPrice": {
- "value": 10,
- "currency": "EUR",
- "vatRates": [
- {
- "rate": 25,
- "value": 2
}
]
}, - "payments": [
- {
- "paymentType": "paymentcard",
- "paymentTypeLabel": "DANKORT",
- "price": {
- "value": 10,
- "currency": "EUR",
- "foreignValue": 15,
- "foreignCurrency": "USD",
- "exchangeRate": "€ 1.5/$"
}, - "truncatedCardNumber": "457100XXXXXX0001",
- "transactionId": "300001116910",
- "transaction": [
- "DANKORT",
- "CONTACTLESS",
- "XXXX XXXX XXXX 0001",
- "TERM: 00123456-123456",
- "NETS A/S",
- "4611721",
- "KC1 NETS NR:0004611721",
- "ATC:00409 AED:0000000",
- "AID: A0000001214711",
- "PSAM: 1234567-000053421",
- "ARC:00 STATUS:0000",
- "AUT. KODE: 1234567",
- "REF:112233 AUTORISERET"
], - "approvalCode": "1234567",
- "cardAcceptorId": "4611721",
- "cardAcceptorTerminalId": "00123456",
- "systemTraceAuditNumber": "123456",
- "retrievalReferenceNumber": "200101110011"
}
], - "loyalty": {
- "skipProcessing": true,
- "stampCount": 3
}
}
Documents provides merchants the ability to upload and attach documents, i.e. user guides, Quick start tutorials, warrenty documents and many more, to receipts.
The user operations in the POS API serve two purposes
The ECR can use the appropriate endpoint to check the identity token and make the choice of what to do.
It is optional to do a lookup of Storebox users before sending the receipts. The Storebox system will discard the receipts that are not matched. It is the preferred method to send all the receipts.
A Storebox user can configure in the Storebox app/website that they prefer not a get a printed receipt.
This is configuration returned in success user lookups
{
"prefersNoPrintedReceipts": true
}
When a card token is used as user lookup, multiple users may have that card added to their profile. In this case prefersNoPrintedReceipts
will return false
if any of the users have disabled green profile
Lookup user by a email hash. Only verified email will be searched. The hash is created by sha(email+salt). The salt value is delivered by Storebox upon request.
emailHash required | string <email> The sha256 hash of the email registered in Storebox |
{- "prefersNoPrintedReceipts": true
}
Lookup user by a phone number. Only verified phone numbers will be searched.
phone required | string The phone number of the user in MSISDN format i.e. with country code, but without thrunk prefix |
{- "prefersNoPrintedReceipts": true
}
Lookup user by a has of the phone number. Only verified phone numbers will be searched. The hash is created by sha(email+salt). The salt value is delivered by Storebox upon request.
phoneHash required | string A sha256 hash of the phone number of the user in MSISDN format i.e. with country code, but without thrunk prefix |
{- "prefersNoPrintedReceipts": true
}
Before sending receipts to the POS API, the sending merchant must be registered. These endpoints allow for creating a merchant and associating a logo, that will be shown with the receipt when displayed in app or web.
Create a merchant. A merchant must be registered in the POS API before sending receipts from the merchant.
merchantName required | string [ 4 .. 32 ] characters Human-readably name of the merchant |
country | string Default: "dk" Country code in lower case |
{- "merchantName": "Storebox",
- "country": "dk"
}
{- "merchantId": "storebox"
}
Each text line can be formatted using a predefined list of attributes. The text line must be prefixed with the attributes and the attributes must be contained within ‘$’ characters. For example, to format a line with bold text use: “$b$ this line will be in bold text”.
More than one attribute can be listed on the same line if placed inside the same pair of ‘$’, but the attributes must be separated using a semicolon ‘;’. For example, to format a line in bold and italic with center aligment use: “$b;i;center$ this line will be in bold italic aligned center”.
Formatting | Attribute | Default | Example | Example output |
---|---|---|---|---|
Bold | $b$ | $b$ Bold text | Bold text | |
Italic | $i$ | $i$ Italic text | Italic text | |
Underline | $u$ | $u$ Underline text | Underline text | |
Strikethrough | $s$ | $s$ Strikethrough text | ||
Alignment | $left$ $right$$center$ | left | $i;left$ Italic left | Italic left |
$b;center$ Bold center | ||||
$b;i;right$ Bold italic center | Bold italic right | |||
Font | $times-roman$ $courier$$helvetica$ | times-roman | $courier$ Monospaced | Monospaced |
Each line can display a predefined list of graphical elements. Each graphical element must be contained within ‘$’ characters and parameters for each element separated by colon ‘:’. For example, to add a centered image use: “$image:fotex:50:center$”. One graphical element is supported for each line.
Element | Format | Parameters |
---|---|---|
Barcode | $barcode:type:value:width:height:alignment$Example$barcode:interleaved2of5:123456789:11:4:left$ |
Type (Required): The type of barcode to generate.
|
Image | $image:name:width:alignment$Example$image:fotex:50:center$ | Name (Required): The name of the image. This name must be agreed upon between the customer and Storebox and being handed over to Storebox before it can be used. However if the merchantId is used for name then the merchant logo is used (if one exists). Regex: [a-zA-Z0-9]+ Width (Required): The width of image in percent or in character columns depending on the context. Alignment (Optional): left, center or right. Default alignment is center. |