A shop system sends an invoice line for two parts. The JSON gives the quantity as 2, the unit amount as 1299, and the line total as 2598. The receiver accepts all three numbers. What should the customer see?

In this example the amounts are US cents. Before tax, the printed line should read 2 × $12.99 = $25.98. A receiver that treats the unit amount as dollars can print $1,299.00 beside each part. Another could convert the total to dollars correctly, then multiply it by two again. Both mistakes start with a perfectly valid number.

I’d put that one line in front of the people building both sides. Agree on who supplies the unit price and who owns the calculation of the total. Run the same conversation with a zero price, then with the price missing. A complimentary part can legitimately cost zero. Someone still has to decide what the importer should do when it has no price at all.

Save the sending system’s output as a test fixture and pass it through the actual importer. Check the resulting quantity, unit price, currency, and total. The first time someone changes how prices are stored, that $25.98 line gives them a quick way to check their work.

An OpenAPI description can carry the field definitions and example payload. Keep the expected invoice line beside the example so the next person can see what those numbers mean at the counter. OpenAPI examples.

Follow the work by RSS ↗

Explore the projects ↗