number — cannot exactly represent many decimal fractions. For example, 0.1 + 0.2 evaluates to 0.30000000000000004 in JavaScript. In financial contexts, those invisible rounding errors compound across calculations and produce incorrect totals. By sending money as a string, the API gives you the exact value and leaves the choice of precision library entirely to your application.
The Money Format
All price, cost, discount, and total fields use a decimal string that matches the pattern^\d{1,10}(\.\d{1,2})?$. The integer portion can be up to 10 digits; the fractional portion, when present, must be exactly 1 or 2 digits. Values are always non-negative.
Valid examples:
Affected Fields
The following fields always carry a decimal string value. When you send them in a request body, format them as strings. When you read them from a response, parse them before performing arithmetic.discount_percentage is a special decimal string bounded between "0.00" and "100.00". It follows the same string format but its valid range is 0–100 rather than an unbounded money amount. The API rejects values outside that range with a 400 validation error.Parsing in Your App
When you read a monetary field from a response, convert it before doing any arithmetic. The safest approach is to use a dedicated decimal library. The example below shows both a quickparseFloat approach (acceptable for display-only use) and the recommended Decimal.js approach for any calculation.