So you added payments to your app.
The checkout button works. Paystack opens. Your test card goes through.
You wrote amount * 100 somewhere and moved on with your life, feeling like a fintech engineer. 😎
Then one day:
A customer pays ₦1,150.15 and your code sends 115015.00000000001 to the provider. 👀
A refund is one kobo short and finance wants a "quick call".
Your company expands to Japan and a ¥500 order is charged as ¥50,000. 😭😭
Nobody hacked you. Nobody broke the provider. It was you. It was always you 😭
In this article we will fix money handling properly, step by step, in Express and TypeScript. No * 100 anywhere. Not even one. 😁
The coin-counting cashier 🪙
Picture a cashier at a busy market stall. You hand her a ₦1,000 note. She does not write "1,000 naira" in her book. She writes it in kobo , the smallest coin: 100000 . Why? Because coins are whole numbers. You can't have half a coin. Whole numbers never get "almost right".
That's exactly how payment providers work.…