Story #01 API Compatibility · Numeric Representation

The Currency Formatting Incident

"A type change that passed all unit tests—and corrupted thousands of invoices"

PioneerPay changed monetary values in its payment API from strings to numbers. Every service-level test passed. Downstream systems that formatted the values as strings broke silently, shipping incorrect invoice totals for weeks before anyone noticed.

What happened

PioneerPay’s transaction API had always returned monetary amounts as strings—"125.50" for a dollar value. During a modernization effort, the team changed the response type to a numeric value: 125.5. Unit tests passed. The service deployed successfully.

Downstream billing portals, finance reconciliation apps, and reporting warehouses had all written their own formatting logic against the string representation. When the type changed, that logic either crashed or applied string operations to a number, producing wildly incorrect totals. Some services formatted 125.5 as "$1255" by removing the decimal point. Others returned NaN.

Thousands of invoices shipped with incorrect totals before the first support ticket arrived. The issue had been live for two weeks.

Root cause

No consumer-driven contract tests existed. The API team tested that the endpoint returned valid values; nobody verified that existing consumers could process those values correctly. A type that “means the same thing” to humans is a breaking change to code.

The fix

The team rolled back to string representation while adding contract tests for every known consumer. Going forward, any numeric representation change required consumer sign-off in an automated test suite before deployment.

Lesson learned

A type change is a breaking change—even when the data is semantically identical. API contract testing must validate the format consumers actually receive, not just the values the server intends to send.

The Currency Formatting Incident