currency and a value. currency is an ISO 4217 alpha-3 code. value is the amount in major units of that currency: send 25 for USD 25.00, not 2500.
Sixteen currencies have no minor units. For these currencies, value must be a whole number. Yuno does not round or truncate the value for you: a request with a fractional value returns 400 INVALID_PARAMETERS before Yuno creates anything.
Request
Zero-decimal currencies
Every other currency accepts a decimal
value. COP is not on the list, because ISO 4217 gives the Colombian peso two decimal digits, so COP 11833.2 is accepted while KRW 11833.2 is not. The decimal digits of each country’s currency are listed in the Country reference.
Trailing zeros do not fail the check: 11833.00 is accepted for KRW, 11833.2 is rejected.
Where the rule applies
Yuno checks every field that carries avalue next to a currency code, on the request that creates the operation and on the request that updates it:
amounton checkout sessions, on payments, and on payment links.amounton refunds: Refund payment, Cancel or refund a payment, and Cancel or refund a payment with transaction. The check runs before Yuno looks up the payment, so a fractional partial refund of aKRWpayment fails with the same error.currency_conversion.cardholder_amountagainstcardholder_currency, andmerchant_amountagainstmerchant_currency.- Split payment amounts and the
fixed_amountof a recipient’s split configuration. - Subscription, plan, meter, shipping method, and payout amounts.
The error
Response
cardholder_amount returns The field 'currency_conversion.cardholder_amount' has an invalid amount.
Round once, when you build the order
If your catalog prices items in two decimals, round each line to a whole unit when you build the order, with the rounding rule your pricing requires, and store the rounded values. Send those same whole numbers on the checkout session, the payment, and every refund. Do not round at each API call from the two-decimal values. A total rounded once and a set of line items rounded one by one can differ by a unit, which makes a partial refund fail or the sum of the refunds exceed the charged amount. For a partial refund, compute the refundvalue from the stored whole-unit line amounts and check that the sum of all refunds of the payment does not exceed its charged amount.value.
Example
The first request is rejected becausevalue has a fractional part. The second request is the same order with the value rounded to the won.
Rejected
Response
Accepted
Partial refund
Related
- Reference: Troubleshooting lists this error with the other common responses.
- Reference: Country reference gives the currency and its decimal digits for each country.
- Guide: Refund payments covers complete and partial refunds.
- Reference: Payment details breaks a total into fees, shipping, tips, taxes, and discounts.