Currencies
Learn how to correctly use currencies and amounts within the APIO API.
APIO represents all monetary values as positive integers, according to the precision defined for each currency. This approach avoids floating-point errors and ensures consistent calculations.
For example:
100represents CLP $100 (the Chilean peso has no decimal places)1.0001represents UF 1.00 when the currency precision is2
Supported Currencies​
Currencies sent through the API must be provided in lowercase, for example: clp or uf.
| Currency | ISO Code | Precision | Amount | Charged Amount |
|---|---|---|---|---|
| 🇨🇱 Chilean Peso | CLP | 0 | 1000 | CLP 1000 |
| 🇨🇱 Unidad de Fomento (UF) | CLF | 2 | 10234 | UF 102.34 |
Precision​
The precision field defines how many decimal places a currency supports.
UF Truncation​
When working with Unidad de Fomento (UF), APIO truncates decimal values according to the configured precision.
- Values are never rounded up
- Any extra decimal digits beyond the supported precision are discarded
For example, with a precision of 2:
UF 10.239→ UF 10.23UF 10.230→ UF 10.23
This behavior aligns with common financial practices in Chile and ensures predictable and consistent billing.
Best Practices​
- Always send amounts as integers
- Never send floating-point numbers
- Use the correct ISO currency code and lowercase identifier
- Validate the currency precision before calculating amounts
- Be aware of truncation rules when working with UF
Following these rules ensures accurate billing and prevents rounding issues when working with monetary values in Chile.