Expose makes the HTTP API of eKasa at the point of sale available to your cloud software. eKasa opens an encrypted connection to the Expose server itself and gets a permanent HTTPS address. The point of sale needs no public IP address, port forwarding or VPN.
HTTPS
encrypted connection
Requests and responses are the same as with a local connection; only the address and the authentication change. Only the API is available through Expose, not the eKasa web interface.
Getting Expose
We set up Expose for each eKasa separately. Write to us which software you run and how
many cash registers you want to connect. For each cash register you receive credentials: a subdomain name, a public
key and a private key. The subdomain has a random name starting with x-.
Settings in eKasa
Expose is turned on in the eKasa web interface, the same way on a computer and on Android: menu Systém → Nastavenia (System → Settings), tab Rozšírenia (Extensions), card Expose.
- Turn on Expose
Switch on Aktívne (Active). Leave the Expose server field at its default.
- Enter the credentials
Fill in Názov subdomény (subdomain name), Verejný kľúč (public key) and Súkromný kľúč (private key) you received from us.
- Create an access key
In the Prístupový kľúč (access key) field, generate it with the button on the right or enter your own. Your software authenticates with this key.
- Copy the key and save
For security reasons the access key and the private key are no longer shown after saving. Copy the access key before you save the settings.
After saving, the card shows the address where eKasa is available, a sample request and the connection status.
Calling the API
The eKasa address via Expose is https://{subdomain}.expose.ninedigit.sk. The path is shorter than with a local
connection by /api, because Expose routes every request to the /api endpoint:
local: POST http://localhost:3010/api/v1/requests/receipts/cash_register
via Expose: POST https://{subdomain}.expose.ninedigit.sk/v1/requests/receipts/cash_register
Send the access key in the x-access-token header:
curl -H "x-access-token: {access_token}" https://{subdomain}.expose.ninedigit.sk/v1/product/info
You can also send the key in the query parameter ?access_token={access_token}. The header is safer, because query
parameters often end up in logs. You can change the header name, the parameter name and the allowed method in the
Pokročilé (Advanced) part of the Expose card.
Without a key or with a wrong key, eKasa returns status 401 and the error
-1000: Unauthenticated with "authScheme": "AccessToken".
The PHP client works locally as well as via Expose.
Several cash registers and businesses
Every eKasa has its own subdomain and its own access key. Your software stores the address and the key of each cash register and sends requests to it. This way you can serve any number of cash registers and businesses. Each business still needs its own CHDÚ storage (see FAQ).
Protect the access key like a password: keep it on your server, not in a browser or mobile app. If it leaks, generate a new one in the Expose card and save the settings. The old key then stops working.
When eKasa is not reachable
A request reaches eKasa only when the device at the point of sale is on, eKasa is running and it is connected to the internet. Otherwise the call fails. Your software should show the cashier that the cash register is not reachable and let them try again.
If the response to a receipt registration is lost, for example because of a timeout, the receipt may have been
recorded. Send the same request with the same externalId: eKasa does
not record the sale twice and returns the result of the original registration.
At the point of sale, the connection status is shown in the Expose card in the settings and by the Expose check
in the status check. eKasa connects to the server over HTTPS. If the shop’s network blocks
WebSocket connections, choose Typ prenosu: LongPolling (transport type) under Pokročilé (Advanced).