Skip to main content
POST
Returns the list of rounding rules, optionally filtered by currency and country
Returns the list of rounding rules, optionally filtered by currency and country The RangeBehavior on each RoundingRange selects one of the behaviors below. Expand for the calculation logic, the important notices, and worked samples.
1 — Absolute target. In this behavior all the values within the specified range (LowerTarget, UpperTarget, Threshold and RoundingExceptions) denote the values themselves as is, without the need for any additional math operations. Getting rounding result (R) for the source number (S) must be implemented as follows:
2 — Relative Decimal target. In this behavior all the values within the specified range (LowerTarget, UpperTarget, Threshold and RoundingExceptions) represent floating point numbers between 0 (inclusive) and 1 (inclusive), used to calculate the respective absolute values, relative to the calculation base (B) as follows:
3 — Relative Whole target. In this behavior ALL the values within the specified range (LowerTarget, UpperTarget, Threshold and RoundingExceptions) represent non-negative whole numbers, while TargetBehaviorHelperValue (V) is used to determine the calculation base (B). V must be a power of 10 (10, 100, 1000, etc.) and denotes the order of magnitude for the range “split” by the Threshold. For example, if Threshold = 9 we need to know if this is 9 out of 10 or 9 out of 100. Getting rounding result (R) for the source number (S) must be implemented as follows:
4 — Nearest target. In this behavior, LowerTarget and UpperTarget represent non-negative floating-point numbers, while TargetBehaviorHelperValue (V) is used to determine the calculation base (B). V must be a whole divisor of any power of 10 (5, 10, 25, 50, 100, 250, 500, 1000, etc.). The threshold must be any floating-point number between 0 (inclusive) and V (exclusive). Getting rounding result (R) for the source number (S) must be implemented as follows:
  • If the result of rounding is a negative number, it must be set to zero, for any rounding behavior defined in the table above.
  • If either LowerTarget or UpperTarget value violates MaxDecimalPlaces setting for the respective currency, this value must be truncated accordingly. For example, if UpperTarget is set to 0.999 for USD, it must be truncated to 0.99 before using in any further calculations.
The following samples indicate how rounding X to Y (X → Y) is implemented using the respective settings. Each numbered column is one settings scenario together with its sample results (re-extracted from the source table, preserving column alignment).
Setting12345
Sample results (X → Y)0.25 → 0
3 → 0
1.5 → 1.5
2 → 2
22.47 → 21.95
22.48 → 22.99
22.50 → 22.50
33.75 → 33.75
2047 → 1995
2048 → 2100
122.26 → 124.99
122.25 → 119.99
127.26 → 129.99
121.50 → 121.50
127.50 → 127.50
123 → 123
128 → 128
2047 → 1999
2048 → 2100
From0110001001000
To325010000100010000
Threshold3.010.48482.2648
LowerTarget00.95950.990
UpperTarget00.991000.991
RangeBehavior1 Absolute2 Relative Decimal3 Relative Whole4 Nearest4 Nearest
TargetBehaviorHelperValue1005100
RoundingExceptions1.5, 20.50, 0.751.50, 2.50, 3

Query Parameters

countryCode
string

2-char ISO country code. If not specified, rounding rules for all the countries supported by the Merchant will be returned

currencyCode
string

3-char ISO currency code. If not specified, rounding rules for all the currencies supported by the Merchant will be returned

Response

200 - application/json

List of rounding rules.

RoundingRule
RoundingRule · object[]

Returns list of rounding rules for currency.