Case study · Payments

Hamrah Card

A payments app with more than five million users. I helped move it from MVC to MVVM-C, added on-device card recognition, and kept it in front of iOS users when the team's Apple Developer account was suspended.

Role
iOS Developer
When
Jun 2022 to Sep 2023
Stack
Swift · MVVM-C · TensorFlow · iXGuard · Flutter (backup channel)
Scale
5M+ users · 98.9% crash-free
Overview

Five million users and no pause button

Hamrah Card is a payments and money-transfer app with more than five million users. People use it for card-to-card transfers across dozens of banks, bill payments and mobile top-ups. I joined as an iOS developer in June 2022 and stayed until September 2023.

During that time the app went through an MVC to MVVM-C refactor, a backend redesign, an on-device card scanner, and one emergency that had nothing to do with code: the team's Apple Developer account was suspended.

The problem

Keep releasing, and get better while doing it

The app was live, busy and under constant release pressure. The codebase was older MVC, and the backend it talked to was being redesigned at the same time. The job was continuity: keep releases going, keep the crash rate down, make loading faster, and change the architecture underneath all of that.

Constraints

  • Scale. At five million users, a release has to be safe for everyone, not only correct on a test device.
  • Continuous releases. There was no separate window for architecture work.
  • Two backends at once. The client had to work against the old and new API during the transition.
  • Card data stays on the phone. Reading a card with the camera could not mean sending camera frames to a server.
  • A hardened binary. A payments app needs real obfuscation and anti-tamper protection.
Architecture

A native app, a hardened build, and a backup channel

MVVM-C replaced MVC. An on-device model replaced typing in a card number. And for one stretch, a second delivery channel stood in for the App Store.

Hamrah Card architecture: a native iOS MVVM-C app with an on-device TensorFlow/ONNX card scanner and an iXGuard-hardened release build talks to a backend undergoing redesign, with a Flutter and WebView contingency channel used during an App Store distribution outage. CONTINGENCY Flutter + WebView iOS & Android, during outage IOS APP · NATIVE Views Feature screens ViewModels + Coordinators MVVM-C, replacing MVC Card Scanner TensorFlow + ONNX, on-device Obfuscated Release iXGuard-hardened binary BACKEND New Backend API REST, redesigned Bank Network Integrations Transfers across partner banks Legacy Backend Phased out during migration Reliability Telemetry Crash + performance profiling REST
The Flutter and WebView build was not a redesign. It was a second way to reach the same backend, built to survive a distribution outage the native app could not get around.

The refactor moved one feature at a time from MVC to MVVM-C, while the backend changed under it. Card capture runs through an on-device TensorFlow model that reads the card number, the cardholder name and other fields from the live camera feed. Nothing is uploaded to do that. Every release build goes through iXGuard before distribution.

We also used feature flags and A/B tests to roll changes out gradually instead of flipping them for five million people at once.

Decisions

What we chose, and what we paid for it

Refactor feature by feature instead of a rewrite

Releases to five million people never stopped during the migration.

What it cost

Old and new patterns lived together for a long time, which means more to hold in your head on every change.

On-device card recognition instead of server-side OCR

Card data never leaves the phone just to be read from a camera frame.

What it cost

Accuracy and speed are limited by what runs well on older phones, not by server compute.

A Flutter and WebView build while the account was down

iOS users kept a working app through the whole suspension.

What it cost

A full second implementation that we built quickly and then retired once native distribution came back.

Hard parts

The one that was not a code problem

Losing the Apple Developer account

The team's developer account was suspended in the middle of a release cycle, with no date for when it would come back. Native iOS distribution was simply gone. We rebuilt the app in Flutter with a WebView shell in a short window, using the Android delivery path, so iOS users still had something that worked. When the account came back, the native app went out again through TestFlight.

Robert C. Martin has a chapter in The Clean Coder about saying no, and about not promising what you cannot deliver. That chapter is the reason we told the business "here is a fallback and a realistic timeline" instead of "it'll be back next week".

Refactoring against a moving backend

Migrating the client and redesigning the backend at the same time meant there was never one stable target. It worked, but only because we kept the old and new paths running side by side until the new one had proved itself.

Small percentages at large scale

Taking 12% off load times and improving overall performance by 20% meant a lot of profiling on an app with millions of daily sessions. At that scale a regression is felt within hours.

Results

Measured under real load

98.9%
Crash-free sessions
Through profiling, debugging and architectural fixes.
−12%
Load time
From focused work on the busiest screens.
+20%
Overall performance
Plus 7% fewer bugs after refactoring legacy code with other teams.
Security

Hardening a payments app

  • Every release is obfuscated with iXGuard before it ships.
  • Card recognition runs on the device. Camera frames are never sent anywhere to be read.
  • The account suspension showed us a single point of failure that was not technical at all. The backup channel existed so a platform account problem could not take the product away from iOS users.
Looking back

What a real outage taught me

  • Not every production emergency is a bug. Losing a distribution account takes an app offline as completely as a crash does.
  • Know your fallback before you need it. We built ours under pressure. It would have been calmer to have it sketched out in advance.
  • Refactor and redesign in parallel only with discipline. Running both at once is possible, but you give up having a stable target, and that cost should be said out loud.