Skip to main content

Amount format

Waffo amounts are represented uniformly as the String type. Do not use Number, float, or double.
String is required instead of Number to avoid floating-point precision issues. 0.1 + 0.2 = 0.30000000000000004 is not acceptable in financial contexts.

Decimal place rules

Different currencies have different decimal place requirements.
Passing the wrong number of decimal places returns a parameter error (A0003).

2 decimal places (most currencies)

The following currencies require amounts expressed to exactly 2 decimal places:

Currencies with 0 decimal places

The following currencies use 0 decimal places. For VND, you can omit the decimal places or include fractional digits that are all zeros. Amount validation fails if any fractional digit is non-zero.

Special currencies (0 decimals same-currency, 2 decimals cross-currency)

The following currencies do not allow decimals for same-currency orders, but allow 2 decimal places for cross-currency orders:

Same-currency vs cross-currency orders

Cross-currency order parameters

In a cross-currency scenario, userCurrency is optional. However, if payMethodType or payMethodName is not fully specified, pass payMethodCountry to tell Waffo which country the user is in. Waffo handles exchange rate conversion automatically. The user sees the local currency amount on the checkout page.

Full currency list