KNOWLEDGE WALLET & TRANSACTIONS
Multi-Currency Wallets: Amount Precision and Rounding
A wallet can handle EUR, JPY and BHD only if it knows what each amount means. This guide explains ISO minor units, provider API exceptions, exact ledger arithmetic, rounding rules, currency conversion and reconciliation checks that prevent costly balance errors.
This is a reference integration model, not a specification for CASINO-AGG or any particular provider. Actual request formats, party responsibilities and settlement rules depend on the agreed API contract.
A wallet balance is a currency-specific financial position
A bet of 10 EUR and a win of 10 JPY contain the same number but not the same value. An operator cannot safely add them or deduplicate them as equal amounts. Every authoritative wallet movement must carry a currency, exact value, transaction identity and account scope. A multi-currency player experience may have several currency-specific subaccounts, a single base-currency ledger with explicit conversion, or another contractual model. The integration must state which model is authoritative before accepting money instructions.
Money precision is also part of transaction correctness. A provider may send a decimal string such as 10.25, an integer representing minor units such as 1025, or a value in an integration-specific scale. Reading 1025 as 1025 major units would be a hundredfold error if the contract defines cents. Conversely, dividing every amount by 100 can corrupt currencies with other minor-unit rules. Correctness begins at the protocol boundary, not at display formatting.
This guide treats currency metadata, exact arithmetic, conversion and rounding as one financial control. The design goal is to preserve the provider's agreed monetary meaning from signed request through durable ledger and reconciliation report. A public API example is not evidence that CASINO-AGG supports a given wallet architecture or provider.
The currency and conversion examples are explanatory. Exact supported currencies, permitted precision, exchange-rate sources, account rules, fees and authorization depend on the operator's approved contract and applicable requirements. Never enable currency conversion merely because a field can be parsed.
Distinguish ISO currency minor units from provider API scales
ISO 4217 identifies currencies and their published minor-unit conventions. SIX is the official maintenance agency for the ISO currency code lists. Many currencies have two decimal places, but that is not a universal rule. Adyen's official documentation illustrates two-decimal GBP, zero-decimal JPY and three-decimal BHD. A robust currency registry must therefore retain the currency code, the effective minor-unit metadata and the precise rules relevant to each integration.
| Illustration | Currency convention | Value of 10 major units in standard minor units |
|---|---|---|
| GBP | Two decimal places | 1000 |
| JPY | Zero decimal places | 10 |
| BHD | Three decimal places | 10000 |
| Adyen ISK API exception | Adyen expects a two-decimal representation despite ISO's zero-decimal convention | 1000 in that API's special representation |
| Stripe ISK API exception | Backward-compatible two-decimal value with trailing 00 required | 1000 for 10 ISK under Stripe's documented rule |
The last two rows are provider-specific representation rules, not changes to ISO 4217. Adyen explicitly documents exceptions for several currencies, and Stripe documents special charging and payout behavior for currencies including ISK, HUF and TWD. An adapter should therefore keep both reference currency metadata and the provider-method amount scale, including version and context. A generic utility called toMinorUnits(currency, amount) is unsafe if it assumes the provider's API always follows ISO exactly.
Currency code validity and payment support are different questions. A code can be recognized but unavailable for a particular game, player, jurisdiction or provider method. Check the permitted currency set and exact amount limits from the integration contract before converting or authorizing any debit.
Parse external amounts using the documented unit and field type
VeliGames' wallet documentation describes amount.amount as a decimal value paired with amount.currency. Aviatrix's seamless wallet documentation describes integer bet and win amounts in minor-currency-unit form, with examples expressed as cents. Neither format can be inferred safely from the number alone. Convert only after validating the provider, method, currency, amount sign, contract version and supported scale. Reject missing or unexpected fields rather than trying to guess whether 100 means 100 units or 1.00.
Verify provider signature and determine operator, brand, environment and method.
Load the exact allowed currency and external amount representation for this API method.
Check integer or decimal syntax, precision, range, sign and prohibited exponent or localization forms.
Convert to the internal decimal or integer scale without binary floating-point intermediates.
Bind the original literal, currency and normalization rule to the ledger posting for audit.
A user-interface string such as 1,234.50 is a presentation format, not an API number to parse using the server's locale. Decide whether a JSON numeric field, JSON string or integer is allowed. If an upstream JSON parser already converted a high-precision decimal to a binary float, converting that float back into a decimal object may not restore the original value. Preserve or parse an exact textual representation before any approximate conversion.
Normalize negative zero, leading zeros and sign rules consistently, but never change the economic meaning. A zero-value informational update should not be booked as a stake, and a negative amount must be accepted only when the operation contract permits that direction. Validate both amount and currency even on retries of a known transaction identity.
Use exact-value arithmetic and a declared internal scale
Ordinary binary floating-point values are convenient for graphics and statistical estimates, but they cannot represent many familiar decimal fractions exactly. Python's official decimal documentation illustrates why repeated decimal operations and equality checks behave differently from binary floats. Oracle's BigDecimal documentation likewise warns that constructing a decimal from an already approximate binary value can preserve unwanted binary artifacts. A ledger should use carefully constrained integers or decimal arithmetic for authoritative monetary values.
| Representation | Good use | Financial caution |
|---|---|---|
| Scaled integer | A defined currency and internal scale with exact additions | Risk of overflow and mistaken scale conversion |
| SQL DECIMAL / NUMERIC | Exact base-10 values within declared precision and scale | Schema still needs sufficient range and explicit rounding policy |
| Arbitrary-precision decimal | Exact calculations with controlled rounding and division | Context settings can silently change outputs if not pinned |
| Binary float / double | UI animation or non-authoritative analytics | Not suitable as a canonical ledger amount |
| Formatted display string | Localized user-facing rendering | Never parse it as the sole authoritative input |
MySQL's DECIMAL(M,D) gives exact fixed-point storage within its specified capacity; it does not automatically choose the correct business scale or prevent an oversized amount from being rejected or rounded by a surrounding application. A scaled-integer ledger must similarly check bounds before multiplying and carry the scale definition with the schema. All services that calculate the same posting should use the same canonical representation.
Keep display precision separate from computation precision. Internal rates and intermediate values may need more digits than a cashable account balance, but final postings must use the permitted account quantum. Never silently accept a value with unsupported fractional units simply because the database column will truncate it.
Document when rounding happens and which rule wins
Rounding is a business decision applied at a particular calculation boundary. Common modes include half-up, half-even, toward zero and directional rounding. They produce different results at ties or for negative values. There is no single safe choice for every wager, bonus, tax, fee and currency conversion. Oracle BigDecimal and Python decimal expose multiple rounding modes precisely because the required result depends on context. The operator must pin the mode, target scale and event that triggers it.
| Decision point | What must be specified | Typical defect |
|---|---|---|
| Provider request parsing | Reject or accept exact external fractional units | Truncating unsupported input without informing sender |
| Stake and payout posting | Account precision and contract-defined handling | Different services round the same callback differently |
| Fee or commission | Rate precision, calculation base and posting quantum | Applying a percentage to an already rounded subtotal |
| FX conversion | Rate scale, rounding mode and destination quantum | Rounding multiple times or using an unapproved rate |
| Display and reporting | Locale and visible number of digits | Mistaking rounded display for exact ledger balance |
For example, three independent exact components of 0.005 sum to 0.015. Under a two-decimal half-up rule, rounding each component first yields 0.01 + 0.01 + 0.01 = 0.03, while rounding their total once yields 0.02. Both calculations apply a recognizable rounding rule, yet differ by 0.01 because the rounding boundary changed. The correct result depends on whether the contract posts each component separately or posts the total.
Never resolve that difference by silently modifying a posted bet. If allocation requires a residual cent, define who receives it, how it is booked and how identical calculations remain reproducible. Keep the exact pre-rounded value and applied policy available for reconciliation without exposing unnecessary internal details to a player.
Treat currency conversion as an explicit authorized event
An online game might settle in one currency while a player's wallet uses another. A conversion is not a cosmetic display operation: it changes the unit in which the player holds value. The system needs the source and destination currencies, rate direction, quoted rate, rate timestamp, permitted spread or fee, rounding policy and resulting amount. Without these fields, a later dispute cannot reconstruct why a 10.00 source-currency debit became a particular destination-currency posting.
Check that the account and provider contract permit this source-to-destination currency conversion.
Store the approved rate, direction, timestamp, validity and applicable fee or spread terms.
Apply decimal arithmetic and the defined destination rounding rule once at the specified boundary.
Record source debit, destination credit and any separate fee or residual under one auditable conversion reference.
Verify each currency leg independently and explain conversion differences through the recorded quote.
A numerical illustration: at an explicitly hypothetical rate of 1 EUR = 1.2345 USD, converting 10.00 EUR gives an exact intermediate 12.3450 USD. With a two-decimal half-up destination rule and no fee, the posted USD amount is 12.35. Another rounding policy or fee structure could produce a different result. An inverse conversion is a separate event with its own quote; do not expect repeated conversions to preserve the original amount after rounding and spreads.
A publicly displayed market reference rate is not automatically an executable customer rate. The European Central Bank explicitly states that its euro FX reference rates are for information and are not intended for transaction use. An integration must use its contractually authorized conversion mechanism rather than silently taking a public reference number as a settlement instruction.
Keep balances and reserved funds separated by currency
A multi-currency account view may display an aggregate estimate, but that number cannot replace currency-specific financial authorization. If a player has 5 EUR and 500 JPY, the wallet does not simply have 505 transferable units. Each currency requires its own opening balance, ledger movements and closing balance. A game bet must debit the permitted account currency, or invoke a separately authorized conversion; it must not borrow value from another currency merely because the UI shows a converted total.
Real balance, bonus balance, locked promotional funds and pending reserves may also have different spendability. VeliGames distinguishes real and bonus amounts in wallet responses. Determine whether a provider stake includes bonus use, whether returned funds restore the original balance class and how a cancellation affects reservations. A field for informational side-bet value must not be debited in addition to the full stake when the provider already includes it in amount.
- Authorize funds against the account currency and the same committed balance version used for posting.
- Keep independent currency positions with transaction-level precision rather than one mixed numeric balance.
- Record transfers or conversions explicitly with both source and destination legs, linked by one identity.
- Use correct account classes for cash, bonus, reserved and restricted balances when the provider defines them.
- Never derive permitted stake from a rounded multi-currency dashboard total.
Concurrency rules still apply. Two different valid bets can race for available funds in one currency, while retries of the same bet must remain idempotent. A currency mismatch in an incoming signed callback should be treated as a contract or authorization problem, not a prompt for a silent FX conversion.
Refunds and bonus events must retain their original units
A refund usually needs to undo an authorized earlier financial movement in its recorded currency and amount, according to the provider's cancellation contract. It should not recalculate the original stake using today's exchange rate. If conversion happened between the original debit and the player's wallet, keep both original and converted legs plus the quoted rate and explicitly define how a rollback is valued. Different legal and contract structures may allocate the FX difference differently; do not invent one universal refund formula.
A win can arrive after the session expires, and a correcting win can follow a reversal of an earlier payout. Those events still need exact currency and transaction identities. Validate that the referenced original movement belongs to the same player and permitted currency context. Repeating a refund or correction must not create a second credit. A matching transaction ID with a changed currency must be treated as an immutable-parameter conflict.
| Financial event | Currency requirement | Failure to prevent |
|---|---|---|
| Original bet | Debit approved account currency and exact stake | Double scaling or wrong currency debit |
| Win payout | Credit the contract-defined gross amount and currency | Crediting net result as a second win |
| Bet reversal | Reference original debit and allowed compensation units | Refund calculated from a new arbitrary FX rate |
| Win correction | Link to earlier win, retain amount and currency | Silent overwrite of original payout |
| Bonus or promotional payout | Respect permitted balance class and currency | Mixing bonus credits into cash without authorization |
The correction audit trail should show any rate, fee, rounding residual and business authority separately. A provider-specific response may require the new available balance in its own amount scale; normalize outbound responses as carefully as inbound requests.
Include monetary meaning in idempotency and response checks
One callback can be retried after a timeout or processed concurrently by two workers. Its stable financial identity prevents a second posting, but the original immutable amount, currency, account and operation type must also match. If the provider reuses a reference with a different currency or scale, the wallet must not return an old success as though the financial intention were unchanged. AWS's guidance on idempotent APIs emphasizes equivalent repeated intent; casino-specific duplicates must still follow the signed provider contract.
Normalization should happen before computing the financial fingerprint so that equivalent documented representations match, without allowing two distinct amounts to collapse by accidental rounding. Example: if a protocol permits exactly two fractional digits, incoming 1.001 is not a harmless alternate spelling of 1.00. Reject unsupported precision or follow an explicitly authorized rounding rule before assigning identity; do not compare only the displayed rounded value.
- Persist the exact received amount representation and the canonical normalized value with its currency.
- Check the provider's method-specific scale and decimal rules both on first request and duplicate retry.
- Apply a database unique constraint to the agreed business identity, not only a transient HTTP request ID.
- Return the provider-defined duplicate response without recomputing an already committed monetary result.
- Preserve original correction and FX references so retries do not invent a new quote or fee.
Reconcile exact currency postings and explain every residual
For each account, currency and balance class, opening balance plus recorded credits minus recorded debits must agree with closing balance under the contract's posting rules. An FX conversion requires matching source and destination legs, not a direct sum of the two different currencies. Keep original provider amount, normalized wallet amount, applied rate, pre-rounded result, final rounded result, residual and fee identifiers. Distinguish expected rounding residuals from unsupported amount changes.
| Reconciliation check | Evidence required | What a failure may mean |
|---|---|---|
| Provider amount representation | Raw value, contract version, code and external scale | Wrong minor-unit assumption |
| Internal exact amount | Canonical decimal or scaled integer and account currency | Binary-float or parsing defect |
| Balance equation | Opening, debit, credit and closing amounts per currency | Missing, duplicated or wrong-sign posting |
| FX conversion legs | Rate, pair direction, timestamp, source and destination | Incorrect quote or unexplained conversion |
| Rounding residual | Pre-rounded amount, policy and applied quantum | Different rounding boundary or mode |
| Refund or adjustment | Original ID, correction ID and currency | Compensation converted or posted twice |
A difference of one cent should not be automatically tolerated in a ledger that requires exact equality. It may be a valid recorded rounding allocation, but that must be demonstrated. Conversely, a reporting dashboard that rounds converted totals for display may differ slightly from precise ledger data without any missing financial transaction. Audit and support should compare the authoritative values before issuing a correction.
Retention, access rights and evidence integrity apply to exchange-rate quotes and rounding metadata as well as to wallet transaction IDs. Restrict financial logs to useful fields and avoid copying secrets or personal account details into uncontrolled diagnostic output.
Test amount boundaries and rounding across the complete wallet flow
A currency selector working in the UI says little about financial correctness. Acceptance tests must examine exact posting amounts, duplicate requests, provider reports and reverse flows. Execute the same test against incoming and outgoing protocol conversions, store exact strings and compare authoritative ledger balances. Change one property at a time: currency, scale, rounding mode, maximum amount, account balance class or late callback order.
| Acceptance scenario | Expected evidence |
|---|---|
| Two-decimal GBP stake | 10.00 normalized from approved minor-unit value 1000 |
| Zero-decimal JPY stake | 10 remains 10 under standard minor-unit convention |
| Three-decimal BHD stake | 10.000 maps to 10000 standard minor units |
| Provider-specific ISK exception | API's documented scale used, not assumed ISO scale |
| VeliGames decimal vs Aviatrix integer | Each adapter applies its own method-specific parsing |
| Unsupported fractional digit | Request rejected or rounded only by explicit contract rule |
| Half-up tie and aggregate allocation | Chosen rounding boundary yields reproducible posted amount |
| FX conversion with fee | Source, destination, quote, rounded result and fee traced |
| Refund after conversion | Original rate and correction rule preserved, no arbitrary recalculation |
| Same financial ID, changed currency | No second posting; immutable conflict recorded |
| Concurrent bets or late wins | Correct currency-specific available balance and one posting per instruction |
| Ledger and provider report comparison | Exact per-currency totals and explained residuals |
Before production, require written currency support, versioned provider mapping, exact calculation tests, documented rounding ownership and a reproducible reconciliation trail. A multi-currency wallet is trustworthy when every recorded unit can be traced from signed input to posting and, if converted, to an approved rate and explicit rounding decision. That completes the money-flow foundation for integrating games across providers.
Never approve a wallet integration on a blanket assumption that all currencies use two decimals or that public reference FX rates are executable. Verify each supported currency and provider method with real contract fixtures, extreme amounts, corrections and exact ledger equality.
KNOWLEDGE
Sources & further reading
This guide draws on primary technical references and official guidance. Regulatory applicability depends on jurisdiction and implementation.
- SIX — Global Financial Data Standards and ISO 4217
- Adyen — Currency Codes and Minor Units
- Stripe — Supported Currencies
- MySQL 8.4 — DECIMAL Data Type Characteristics
- MySQL 8.4 — Types of Numeric Values
- Python — Decimal Fixed-Point Arithmetic
- Oracle Java — BigDecimal
- VeliGames — Seamless Wallet API
- Aviatrix — Backend Wallet API
- ECB — Framework for Euro Foreign Exchange Reference Rates
- AWS Builders' Library — Making retries safe with idempotent APIs
- OWASP — Logging Cheat Sheet