Payment Amount Units: Why 25 Can Mean 25 Cents
A customer adds a pair of shoes priced at 25 dollars to the cart. The checkout looks right, the order is created, and the payment goes through. Later you notice the customer was charged 25 cents, or 2,500 dollars.
Nothing crashed. No error was logged. The code did exactly what it was told, but it was told the wrong unit.
This kind of mistake is easy to make when you or an AI coding assistant writes a payment integration quickly. The code reads well, the test passes, and the problem only shows up with a real price.
Different APIs read amounts in different units
There is no single rule for how a payment API wants an amount. Two common styles exist:
- The smallest currency unit, as a whole number. For a currency with cents, 25 dollars is sent as 2500, and 25 means 25 cents. Whole numbers avoid the rounding errors that appear when decimals are stored as floating-point values.
- The major unit, as a decimal. 25 dollars is sent as 25.00, and 2500 would mean two thousand five hundred dollars.
EPaySe's API reads the amount in the major unit with at most two decimal places, and its guide recommends sending it as a string such as "25.00". For an API like this, the likely mistake is the reverse of the example at the top: sending 2500 when you meant 25.00 charges one hundred times too much. Whichever gateway you use, read its API guide for the exact format before you write any code, and check it again for every API you add.
The smallest unit is also not the same for every currency. Some currencies have two decimal places, some have none, and a few have three:
- USD and EUR: two decimal places.
- JPY: no decimal places.
- KWD: three decimal places.
These values come from the ISO 4217 currency list. A single rule such as "multiply by 100" is correct for some currencies and wrong for others.
How the mistake happens
The same bug appears in a few common shapes:
- The price is stored in one unit and the request expects another. The code sends 2500 where the API expects 25.00, or the other way round.
- A helper converts twice. One function multiplies by 100 when the price is loaded, and another multiplies again when the request is built, so 25 dollars becomes 250000.
- A fixed multiplier is applied to every currency. It works for the currency you tested and breaks for one with a different number of decimals.
- The field name hides the unit. A field called
amountcould hold dollars, cents or a string. Nobody can tell from reading it.
Why the test still passes
An assistant that writes the checkout can also write the test. If the test builds the amount with the same helper that the code uses, both sides share the same mistake and the test stays green.
A test only catches a unit mistake if it states the expected value on its own, written by a person, in the unit the API documents. For example, a product priced at 25 dollars must produce the exact request amount your gateway documents, and the test should say so as a literal value, not as the result of the same helper.
How to prevent it
- Choose one internal representation and keep it everywhere. Either store prices as integers in the smallest unit, or use a decimal type. Do not use floating-point numbers for money. Convert only at the edge, when you build an API request or show a price to a customer.
- Put the unit in the name. Use names such as
amount_minororamount_majorinstead ofamount. - Convert in one place. Keep a single function that turns your internal price into a request amount, and test it for every currency you support.
- Write literal expected values. Add tests with real prices, one for a currency with two decimals and one for a currency with none.
- Compare with the response. After a test payment, read the amount back from the gateway response and check it against the order total.
- Run a sandbox payment before launch. A sandbox payment shows the amount in the dashboard, where a wrong unit is easy to see.
A quick review checklist
When you read code that an assistant wrote, look for these before anything else:
- Where does the price enter the code, and in what unit?
- Where is it converted, and is that done exactly once?
- Does the conversion depend on the currency?
- Does the request match the unit and format in the API guide?
- Does a test state the expected request amount as a plain value?
Key takeaways
- Payment APIs differ: some read the smallest unit as an integer, others read the major unit as a decimal. EPaySe reads the major unit with at most two decimal places.
- A unit mistake produces no error. It only shows up as a wrong charge.
- Tests that reuse the code's own helper cannot catch it.
- Use one internal representation, name the unit in the field, convert in one place, and test with literal values.
Related reading: What to check in payment code your AI assistant wrote.
As of November 2026, EPaySe is onboarding merchants, reviewed and approved case by case. If you are building an integration, start with the sandbox and the API guide, and contact the team if something is unclear.
Related Articles
Signed Payment Requests: Why a Timestamp Matters
A signed request proves who sent it, not when. Learn how a captured request can be replayed, why AI-written code can skip the timestamp, and what to check.
How AI routes a card payment, and how to test it before you trust it
The same card payment can often travel several routes. Here is how AI routing picks one, what promised uplifts leave out, and how to test it safely.
Why good customers get declined, and what AI risk scoring changes
A real customer blocked by a cautious fraud filter is a false decline. Here is why it happens, why it is easy to miss, and what to measure before changing anything.

Go-Live Checklist for a Checkout Your AI Assistant Built
Before real customers pay, read every line, re-run every test, move the live key to your server settings and start with one small order. A short checklist for AI-built checkouts.