From QR code to usable data

Every receipt you get in a Slovak shop carries a small QR code at the bottom. Most people throw it away with the paper. But that little square is a key: it unlocks the complete, structured record of the purchase, held by the state: every item, every VAT rate, the seller, the exact shop and the cash register.
I needed exactly that data for a project I am involved in, and I needed it with as little effort as possible. This is the story of how a five-step Apple Shortcut and one Linux tool got me there, without writing an app.
What hides behind the QR code
Since 2019, every cash register in Slovakia has been connected online to the
Financial Administration’s eKasa system. Each receipt is registered at the
moment of the sale, and the QR code printed on it carries the receipt’s unique
identifier, the one starting with O- printed under the code.
The Financial Administration lets anyone check a receipt by that identifier. Behind the check is an endpoint that takes the identifier and returns the full receipt as JSON. That was the easy half. The hard half was getting from a crumpled receipt in my pocket to that identifier, and from there to a file I could process, without typing anything by hand.
The app I did not write
My first instinct was a developer’s one: build an app. A PWA, or a React Native app with Expo. Then I counted the cost. A native app on an iPhone means an Apple Developer account for anything beyond a short-lived test build, plus a build and signing pipeline. A PWA needs no account, but it needs hosting, camera permissions and, most likely, a small backend in front of the API. All of that just to find out whether the idea works at all.
It was far too much ceremony for a quick and dirty job.
Apple Shortcuts to the rescue
The answer was already on my phone. Apple Shortcuts is a visual automation tool built into iOS, and it turned out to have every building block I needed. The whole automation did not take long to put together, and it has just five steps:

- Scan QR or barcode opens the camera and reads the code automatically.
- Set variable stores the scanned text as
receiptId. - Get contents of URL sends it as a POST request with a JSON body,
{"receiptId": …}, to the Financial Administration’s endpoint,https://ekasa.financnasprava.sk/mdu/api/v1/opd/receipt/find. - Save writes the response, the receipt JSON, to a
blockyfolder inside the Shortcuts folder in iCloud Drive, named after the receipt ID. - Stop and output returns the saved file.
I tap the shortcut, point the camera at the receipt and a second later the data is in iCloud. And here is what comes back for a single bottle of ink:
{
"receipt": {
"issueDate": "24.10.2026 12:30:46",
"icDph": "SK2120060855",
"receiptNumber": 1351,
"taxBaseBasic": null,
"taxBaseReduced": null,
"totalPrice": 11.199999999999999,
"freeTaxAmount": null,
"receiptId": "O-CF0F65EFA4C7462F8F65EFA4C7162FA7",
"items": [
{
"sellerIdType": null,
"quantity": 1,
"vatRate": 23,
"price": 11.199999999999999,
"sellerId": null,
"voucherNumber": null,
"specialRegulation": null,
"name": "Fľaštičkový atrament Lamy zelený, T 52",
"itemType": "K"
}
],
"paragon": false,
"paragonNumber": null,
"pkp": "HLi9kpfU\/mv6gO98Lq\/i5kmDqvhLniTQ8Myxj\/Q2Pb3zB9Rp\/yWDqfg+2i8lo7n1TX3ekWPWIaX3ZOLaKJFWzG1a0mZY+MAY0\/gggq4ezNaEQJ2L8lmKjSnkwy3vQYmBi5x3yY5a7pjO57tX2M+JS40VMYVuICnMU21eq7zB4eMF8A7ACTDqt7rHeWKQYDCyTEfFFTFK4Dlz+mwTG2+Jf2D\/n0H+V7oS0kcFGQmEhfaAasfL507itc7aIaIJ0uNQiUPntQPnfJw76UCN+j\/Ui242Npzmrle34COLeJMHwfbzY0Iy9bX6TwHGL5I6JLCjiPlSG\/FlwLNJm\/ufRp5c\/w==",
"vatAmountReduced": null,
"customerId": null,
"exemption": false,
"organization": {
"propertyRegistrationNumber": "80",
"municipality": "Lučenec",
"dic": "2120060855",
"manualVatPayer": null,
"vatPayer": true,
"icDph": "SK2120060855",
"streetName": "Vajanského",
"buildingNumber": null,
"postalCode": "98401",
"country": "Slovensko",
"name": "TSV GROUP s.r.o.",
"ico": "48120308"
},
"vatRateReduced": null,
"type": "PD",
"vatSummary": [
{
"vatBase": 9.1099999999999994,
"vatAmount": 2.0899999999999999,
"vat": {
"vatRate": 23
}
}
],
"vatRateBasic": null,
"cashRegisterCode": "88821200608550018",
"invoiceNumber": null,
"vatAmountBasic": null,
"okp": "41c28360-f0877fe9-154169a1-b0c0f0fb-aac03b57",
"unit": {
"municipality": "Poprad",
"country": "Slovensko",
"postalCode": "05801",
"cashRegisterCode": "88821200608550018",
"streetName": "Námestie svätého Egídia",
"propertyRegistrationNumber": "3290",
"buildingNumber": "124",
"unitType": "STANDARD",
"name": null
},
"ico": "48120308",
"createDate": "24.10.2026 12:30:46",
"dic": "2120060855"
},
"returnValue": 0,
"searchIdentification": {
"createDate": 1795508292302,
"searchUuid": "970bc410-e7df-11f1-9485-0d962b6b39cb",
"bucket": 0,
"internalReceiptId": "O-CF0F65EFA4C7462F8F65EFA4C7162FA7"
}
}
That is a lot more than the paper shows: the seller’s company IDs and
registered address, the address of the actual shop, the cash register code,
the VAT breakdown and the receipt’s cryptographic identifiers (pkp, okp).
One detail is worth noticing before you process it: the amounts arrive as
binary floating-point numbers, so 11.20 EUR becomes 11.199999999999999.
Parse money as decimals, or round it to cents, before you sum anything.
Stuck in iCloud
So the first half of the problem was solved. But now my data sat in a proprietary cloud that was not at all friendly when I tried to get the files out for further processing. iCloud Drive has no official API for Linux, and everything I tried hit a wall.
Getting the files out with rclone
It took me several attempts to land on rclone, and then everything suddenly clicked into place. rclone has had an iCloud Drive backend since version 1.69, and it can mount iCloud Drive as an ordinary directory on Linux.
A mount was exactly what I needed, because the processing happens in place. A
cron job picks up each new receipt file from the blocky folder and imports
it. When the import succeeds, the job moves the file into an archive
subdirectory. When it fails, the file goes into fail. Both live in the same
iCloud folder, so the phone and the Linux machine both see the same state:
what is waiting, what is done and what needs a look.
A few things are good to know before you try it:
- Turn on “Access iCloud Data on the Web” on the iPhone (Settings → Apple Account → iCloud). rclone talks to iCloud the same way the web does and cannot work without it.
- Log in with your real Apple ID password and 2FA. App-specific passwords are not accepted.
- With Advanced Data Protection on, every login also has to be approved on a trusted device, such as your iPhone.
- The trust token lasts 30 days. After that rclone has to log in again, and the pipeline stops until it does.
- The backend is marked experimental in rclone’s own documentation. Apple offers no official way to reach iCloud Drive from Linux, so this is the way in, and it holds up well as long as you keep an eye on it.
When the login runs out
The one regular chore is the 30-day limit. I have not found a way to renew it
unattended: rclone config reconnect asked me for a fresh 2FA code, even with
a trust token stored. So renewing is a short manual job, about once a month:
rclone config reconnect iCloud: # enter the 2FA code from your iPhone
systemctl --user restart rclone-icloud-shortcuts # make the mount use the new session
With Advanced Data Protection on, the iPhone then asks once more to allow access to your iCloud data. rclone waits a few minutes for that approval.
The restart matters because the mount holds its own session in memory. I learned that the hard way: my mount kept working happily while the login saved in the configuration had already expired. Nothing looked wrong, but the next reboot would have left the mount unable to start.
That is why the import job, not a separate monitor, is the right place to notice the problem. Through the mount, a dead login is not silent. Once the directory cache runs out (one minute in my setup), every listing, read and move fails with an I/O error. The job only has to treat those errors correctly:
- Check that the folder is really mounted before each run, for example
with
mountpoint -q. If the mount failed to start, the folder is just an empty local directory, which looks exactly like a day with no receipts. - On an I/O error, stop and tell me that iCloud is unreachable and that it is time to reconnect. The error does not say whether the login, the network or Apple is at fault; the details are in rclone’s log.
- Never move a receipt to
failbecause of an I/O error.failis for receipts that could not be imported. A storage error is not the receipt’s fault, so the file stays where it is and the next run tries it again.
Into a container
The whole pipeline, rclone and its configuration included, can be packed into
a container. The only extra is that a mount inside a container needs FUSE:
the container must get the /dev/fuse device and the SYS_ADMIN capability.
A working proof of concept with an open end
What I have built is a functional proof of concept. It runs, it imports real receipts, and it shows the idea works from end to end. It is also deliberately loose: scanning, fetching, storing and processing are separate slots, and each one can be filled with a different tool.
The only thing the phone really has to deliver is the purchase code. Anything with a camera and a QR reader can do that:
- iOS: Apple Shortcuts, as shown above.
- Android: Automate by LlamaLab builds the same flow from blocks: Take picture and Barcode scan read the code, and HTTP request sends it on.
Everything after the scan can move off the phone. Instead of calling the Financial Administration’s endpoint and saving the JSON, the shortcut can post just the scanned code to any API of your own. That service then fetches the receipt, stores it wherever you like and processes it. No cloud drive, no mount and no login to renew: the phone needs only two steps, scan and send.
And when a file in between does suit you, iCloud Drive is just one choice. Google Drive works just as well, and rclone mounts it the same way.
That is the beauty of an open end: start with the tools you already have, and replace one slot at a time when you need something sturdier.
Sweet and easy. A paper receipt, a camera, five blocks in Shortcuts and one Linux tool, and I have structured purchase data without writing a single line of app code. I just love Linux for that…