The service and its payment flow
Mirlink is a healthcare service that stores dental-implant records on a blockchain. A patient gets a card, and when they receive implant treatment at a dental clinic, the record is encrypted and put on-chain.
Money changes hands at two points.
- Card issuance: the patient pays once, when they first get their card.
- Treatment fees: after that, what gets paid through our platform is the actual dental treatment fee, paid on the POS terminal at the clinic's front desk.
And a record only goes on-chain once payment is done. Records move through draft → paid → on-chain, and if a record never reaches paid, it can't move on.
My first POS integration
For payments we used a NICE POS terminal. I'd done web payments through a payment gateway (PG) before, but POS was a first for me.
Here's how it works. The card terminal is connected to the clinic's PC, and a NICE daemon running on that PC talks to the terminal. Our web app sends payment requests to that daemon over a local WebSocket and gets the results back. It's a completely different world from a PG, where a checkout window just opens in the browser.
The first install and test took a lot of fumbling around.
- The integration guide we were given was written for a different model than the product we actually received. No wonder following it didn't work.
- The cable needed to connect it was missing from the standard package. I spent a long time assuming it was a code problem before realizing nothing was physically connected.
Coming from web-only work, "maybe it's the hardware" just wasn't an option in my head. What I learned is that with POS integration, checking that the device and the docs actually match comes before the code.
Sorting out the exception cases
Payment itself wasn't simple either. Fees are decided per tooth, and not every treatment is billable.
- First implant placed in that tooth (initial placement): charged
- The tooth already has any earlier record (re-placement, removal and so on): exempt
- No earlier record and no placement: not billable
So at registration, the system looks at the patient's existing records tooth by tooth and decides whether this visit is charged or exempt. If a visit only has exempt treatments, the payment step is skipped.
That's all for regular dental clinics. The problem was university hospitals.
University hospitals don't bill per visit
The timing wasn't great. Moving from MVP to production, the payment and settlement model had been completely changed from the original plan, and I had just torn down and rebuilt the structure to match. With the new structure and process all in place, a request came in from the planner.
"Please make it so university hospitals don't have to pay."
University hospitals don't collect fees separately for each visit. They have their own billing system, so a step where the treatment fee is paid on our POS doesn't make sense there to begin with. The request itself was perfectly reasonable.
It wasn't a big problem so much as one more exception added to a flow that was already built. But it wasn't as simple as just removing payment either. In the current structure, without a payment, a record can't reach paid, and it can't go on-chain.
Framing it as three options
The request was one line, but there are several ways to implement "don't pay." Which one you pick changes the screens, the state flow, and the records left behind. So instead of building it right away, I first wrote up and shared the current payment process flow, then laid out the university-hospital case as three options on top of it.
- Same process, zero-won payment — the flow is identical to regular clinics, and university hospitals complete payment for 0 won.
- Same process, exemption notice — the flow stays the same, but the payment step shows the visit as "exempt" and moves on.
- Register straight from the payment button — no step for picking which treatment records to include; pressing the payment button puts every record on-chain immediately.
Each option changes different screens and state transitions, so the goal was to let the planner just pick from a product point of view.
Working with the planner — flag it early, ask it back
This was my first project working with a dedicated planner. The planner set the direction, and I turned that into implementation options and handed them back in a form that was easy to decide on.
And I asked a lot of questions. Mostly small ones rather than big decisions. Whenever I saw a gap the spec didn't cover, I didn't fill it in myself; I turned it into a question. Things like:
- "Is the recovery barcode download a one-time thing, only at the start?"
- "Is a password reset flow going to be added too?"
I raised technical constraints up front as well. For example, we had patients download a recovery barcode in case they lost their card, but from the web there's no way to confirm it actually got saved to their photo gallery. Better to say that early than wait for "why can't we check this?"
Each one looks minor, but a gap a developer fills in alone tends to drift from the plan later. If one question can prevent that, it's the cheapest fix there is.
The decision — a zero-won payment
The answer was option 1, the zero-won payment.
University hospitals can enter 0 as the payment amount, and at 0 won the payment is marked complete right away without going through the POS terminal. The payment ledger keeps a 0-won payment record marked as a university-hospital zero payment, and the medical record moves on through paid → on-chain exactly like it would at a regular clinic.
Here's why this approach worked well.
- The state flow stays untouched. I didn't create a special "go on-chain without payment" path for university hospitals. The on-chain registration code stayed as it was.
- There's a record. Instead of skipping payment, a 0-won payment is logged, so nobody looking at settlements or history later has to ask "why does this record have no payment?"
- The server blocks it a second time. For zero-won payments the server re-checks the hospital type and rejects anything that isn't a university hospital. A regular clinic can't get through even if someone enters 0 on screen.
Looking back, what mattered here wasn't the zero-won answer so much as how the answer got picked: show the flow first, split it into options, raise constraints early, and ask about the gaps. Exception cases will keep coming. Rather than digging a new exception path every time, fitting them into the existing flow is what makes the next one easier.