KNOWLEDGE WALLET & TRANSACTIONS
Bet and Win Callbacks: Transaction and Round Identifiers
Bet and win callbacks change player balances, but a game round, a wager and a wallet transaction are different objects. Learn which IDs to preserve, how to post debits and payouts, what late or repeated messages mean, and how to reconcile results safely.
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 bet or win callback is a financial instruction
A casino game can be fully animated in the browser while its money movement is still waiting for a server-side decision. In a seamless wallet design, a provider or aggregator sends the operator a bet instruction to remove a stake and a win instruction to credit a result. These messages are not just notifications for an analytics dashboard: if accepted, they can change the player's available balance. The receiver therefore needs authentication, precise identifiers, an atomic ledger posting and a response that accurately describes the outcome.
Provider documents show why the operation names cannot be universalized. VeliGames exposes separate bet, win and cancel methods and distinguishes transaction, round and correlation references. Tom Horn Gaming's REST or SOAP wallet service uses Withdraw for a bet and Deposit for a win. Aviatrix has its own wallet callback fields, including bet and transaction identifiers. An adapter must translate the meaning of each contract before it maps those requests into an internal ledger.
This article focuses on the identities and state changes that connect a stake to its payout. A later guide covers idempotency storage in depth, while another covers refunds and round cancellation. Here the key principle is that the sequence of browser events cannot be trusted as the accounting sequence, and a returned HTTP response cannot replace a durable financial record.
All endpoint names and payload fields below are illustrations from the cited providers or generic design proposals. They do not mean that CASINO-AGG supports a particular provider, protocol, settlement method or commercial relationship. Use the exact approved integration specification for implementation.
Do not confuse transaction, bet, round and session IDs
These identifiers describe different objects. A session represents an authorized period or context for playing; a game round groups game actions; a bet identifies a wager; and a transaction identifies one proposed financial change. Some contracts also include a provider correlation ID and the operator's own ledger transaction ID. They can occasionally contain the same string by design, but they must not be treated as synonyms. Naga Games documents a bet-status lookup that returns separate bet, place-bet transaction and payout transaction references.
| Identifier | Typical purpose | Uniqueness and lifecycle caution |
|---|---|---|
| Operator and brand | Tenant and financial responsibility boundary | Always scope lookup and authorization to the correct tenant |
| Player reference | Account receiving a debit or credit | Never infer the player from a round ID alone |
| Session ID | Launch and authentication context | Can expire before late results are settled |
| Round ID | Groups related game activity | May be global across many players or contain multiple bets |
| Bet ID | Identifies a particular wager within game activity | One round can hold several wagers or bet changes |
| Provider transaction ID | Identifies a monetary instruction for duplicate detection | Scope and retention must be agreed with that provider |
| Wallet posting ID | Identifies the operator's actual ledger movement | Preserve the mapping to the provider instruction |
| Correlation or original ID | Connects a payout, retry or reversal to another event | Not necessarily unique to every monetary posting |
A particularly important edge case appears in multiplayer crash games. VeliGames documents that a round ID can be shared by multiple players participating in a global round. Using roundId alone as a unique database key could cause one player's transactions to overwrite another player's. Build the correlation key from the provider's documented scope plus operator, player and other required fields; use a separate stable transaction identity for posting money.
Separate stake, gross payout and net round result
Suppose the player's available balance starts at 100 units. A confirmed stake of 10 removes 10, leaving 90. A later payout of 25 adds 25, producing 115. The net result of that simple round is plus 15, not plus 25. The win callback in this example carries a gross credit of 25, not an instruction to credit the net result of 15. That distinction prevents both double-crediting and incorrect financial reports.
| Recorded event | Balance change | Balance after posting | Interpretation |
|---|---|---|---|
| Opening balance | 0 | 100 | Starting position, not a game transaction |
| Bet transaction B-01 | -10 | 90 | Stake is debited once |
| Win transaction W-01 | +25 | 115 | Gross payout is credited once |
| Round result | +15 | 115 | Derived as posted credits minus posted debits; do not post again |
The arithmetic is only a teaching example. Some interfaces combine stake and settlement, some publish several wins in one round and some report a zero payout for a loss. Certain promotional results may have no ordinary stake. The operator must establish whether an amount field means a debit, gross payout, net adjustment or informational figure before applying it. Never apply the same financial effect twice because both a callback and an aggregated round report describe it.
A bet callback must authorize and post the stake atomically
On receiving a bet, the wallet first verifies the trusted sender and resolves the exact player, operator, game and currency. It checks that the transaction identity is not already associated with a different instruction and applies the relevant spending, eligibility and available-balance rules. The final balance check and ledger debit must be one consistent decision. Reading a balance in one request and subtracting money in another without concurrency protection can allow two simultaneous bets to spend the same funds.
Authenticate the callback and validate the tenant, player, operation type and required fields.
Find the exact provider instruction by the agreed unique reference and compare immutable parameters.
Check allowed game activity, sufficient available funds, currency and applicable restrictions.
Create one durable debit and bind it to the provider ID, bet ID and round context.
Return the provider-defined success, duplicate, insufficient-funds or pending result from durable state.
If the request cannot be resolved safely, an ambiguous timeout is not a reason to invent either success or failure. Retain enough information for status lookup and recovery. If the provider's schema includes separate side-bet, jackpot contribution or promotional values, determine whether those are included in the main stake or represent separate ledger instructions. VeliGames, for example, documents a side-bet value that is informational because the main amount already includes it.
Credit a win without requiring an active browser session
A payout may arrive after a player closes the game, loses connectivity or the launch session expires. Those events do not erase a previously accepted wager. VeliGames explicitly documents processing wins and cancellations after session expiry under its wallet contract. The operator should authenticate the financial sender independently of the browser connection, locate the correct account, validate the relationship to the round or permitted exception and post the credit exactly once.
Parse the provider's win operation and its independent transaction reference.
Bind the event to an operator, player, currency and eligible round or accepted promotional exception.
Recognize a replayed payout and reject conflicting reuse of an existing reference.
Apply the provider-defined payout amount to the authoritative account through a durable ledger entry.
Store original and internal IDs, accepted amount, resulting state and receipt timestamps.
An ordinary win will often refer to an earlier bet, but a strict rule that every credit must find an immediately preceding bet is not correct for every contract. Bonus wins, provider adjustments and exceptional rewards may be modeled differently. VeliGames documents promotional and adjustment cases separately. Such credits still need a specified authorization path and provenance; do not make missing-bet acceptance a universal loophole.
- Keep the win transaction ID distinct from the original stake or round reference unless the provider defines otherwise.
- Interpret a zero amount according to the event type; it may be a state update rather than a monetary credit.
- Return the exact success or duplicate response specified by the provider, not an assumed HTTP convention.
- Keep settlement processing available to authorized financial callbacks when a browser session has already ended.
Design for delayed and out-of-order events
A provider can finish a round while the operator is still waiting for a previous response, or one callback can be delayed by a temporary network failure. Message arrival order is therefore not reliable proof of business order. A win may reach a service before the corresponding bet is visible to that service; a duplicate can arrive after a successful acknowledgment was lost; and an older round can settle after the player has opened a new game. Different contracts assign different retry and ordering obligations.
| Observed order | Unsafe reaction | Safe design decision |
|---|---|---|
| Win before related bet | Credit blindly or permanently discard | Apply the documented exception policy or hold for bounded correlation and status inquiry |
| Same bet delivered again | Debit again because it is a new HTTP request | Resolve prior transaction identity and return contract-defined duplicate result |
| Late win after logout | Reject solely because the browser token expired | Authenticate financial callback and settle according to round contract |
| Old round after new launch | Attach event to the newest session | Use original player and round references rather than current browser state |
| Correction after prior close | Refuse any update to a closed round | Use provider-supported correction or resettlement state transition |
A pending queue can help with a genuine dependency but cannot serve as permanent proof that money did or did not move. Keep a deadline for investigation, a query path to the provider and an operator-side reconciliation owner. Where the contract requires an explicit rejection rather than pending acknowledgment, follow that rule and record the attempted event for diagnosis. Never invent a universal status code to force all providers into one ordering strategy.
A round may contain more than one debit or credit
The simplest slot example has one stake and one result, but real content can have multiple stakes, side games, separate winnings, bonuses, partial cash-outs or a final adjustment. A round identifier groups events; it is not itself a guarantee of one bet and one win. Aviatrix's game-round reporting documents a round with multiple bet records. VeliGames describes distinct round lifecycle details for some sportsbooks and warns that a casino provider's roundClosed field may carry different semantics from a sportsbook's finality signal.
| Round structure | Possible events | Ledger implication |
|---|---|---|
| Simple slot spin | Bet, then win or documented loss result | Debit and credit are separate postings |
| Crash round shared by players | Many player bets tied to one global round ID | Round ID alone cannot identify an account |
| Feature or bonus sequence | Several related payouts or a special reward | Do not infer one mandatory win per stake |
| Partial cash-out | Stake and one or more partial settlement events | Preserve distinct transaction IDs and remaining open amount |
| Round correction | Cancel or reverse an earlier event, then adjusted outcome | Original and correction postings both remain auditable |
Represent a round as a set of related monetary and state events. The system may maintain a derived round summary for support and reporting, but that summary must never be credited as another win. Do not close financial reconciliation on a generic roundClosed flag unless the actual contract guarantees that interpretation for the game type. The difference between a closed presentation and an immutable financial outcome matters when adjustments are possible.
Authenticate the sender and authorize the targeted account
A financial callback should never be trusted because it arrived at an obscure URL or includes a familiar-looking round ID. The operator must verify the agreed signature or authentication credential, bind it to the expected provider and tenant, and independently check the player account and currency. OWASP's webhook security guidance covers sender verification, replay resistance and safe processing acknowledgments. Provider documentation may demand an exact field order, canonicalized bytes, time window or response shape for signatures; follow that protocol rather than a generic replacement.
- Reject a validly signed request if the signed operator, brand or player does not match the permitted account scope.
- Use appropriate timestamp or nonce replay protection when defined by the integration contract.
- Keep browser launch credentials separate from server-to-server wallet callback credentials.
- Restrict access to posting history and redact credentials, signatures and unnecessary player details in logs.
- Record verification failures separately from expected business failures such as insufficient funds.
Authentication and idempotency solve different problems. A request can come from a genuine provider and still be delivered twice. A transaction ID can be unique but the requested player or currency can still be unauthorized. Both checks must pass before any money changes. For replayed financial instructions, the receiver must use the contract's authenticated duplicate-resolution behavior rather than skip authentication simply because it has seen the ID before.
Acknowledge durable outcomes and handle ambiguous timeouts
If a wallet posts a debit but the response disappears in transit, the sender may not know whether the bet was accepted. RFC 9110 explains why repeating a non-idempotent operation requires special knowledge of its semantics. Stripe's idempotency documentation provides a general example of retaining the identity of an intended operation across retries. An actual casino wallet must honor the more specific provider transaction rules, which can differ from Stripe's service.
There is no universal duplicate status. VeliGames documents an HTTP 409 duplicate transaction response, whereas Tom Horn Gaming documents a duplicate reference code and original transaction information in its wallet interface. Treat these as two different contracts. Returning a generic success in one integration or always returning 409 in another may trigger retries, disputes or broken game flow. A successful callback response should reflect a committed or durably resolved state under the contract's acknowledgment model.
- Persist the operation identity and immutable parameters before declaring a final monetary result.
- Use the same business reference for the retry of one intended debit or credit.
- Distinguish a transient transport error from a validation failure and a transaction already posted.
- After an uncertain response, consult durable status or reconciliation evidence before issuing a new financial instruction.
- Bound retries and escalate unresolved mismatches rather than retry forever.
Keep corrections linked to the original transaction
A cancelled round or corrected result should not erase history. The operator needs to know which original bet or win is being adjusted, which contract action authorizes the adjustment, and whether it is a full reversal, partial refund or revised settlement. VeliGames documents distinct cancel behaviors, including cancellation of one transaction and cancellation of a round. Some sports settlement flows can reopen an earlier closed result. Those specifics are not universal casino semantics.
Keep original transaction ID, correcting transaction ID, amount, currency and reason together. A correction to a win may be a debit, while a cancellation of an earlier stake usually returns funds. Applying the correction twice is a second accounting error even if the original event was valid. Detailed accounting for rollback combinations belongs to the dedicated follow-up article, but the reference model must be designed when the first bet callback is implemented.
An auditable correction is a new authorized financial event linked to its predecessor. Do not quietly edit the original debit or credit so that later provider reports appear to match. Keep both the economic effect and the chronology inspectable.
Verify the ledger against the provider event trail
An integration is ready when it can prove what happened after a lost response, not merely when a normal spin succeeds. A reconciliation job should compare provider bet and win reports with the operator's posted ledger entries by tenant, player, provider, currency, round, original operation and internal posting. Aviatrix documents a game-round lookup, while Naga Games documents a bet-status query. Whether those exact retrieval methods exist depends on the provider; the acceptance plan must identify an equivalent evidence source.
| Acceptance test | Expected evidence |
|---|---|
| Bet arrives and is accepted | One authorized debit with provider and wallet transaction references |
| Same bet is delivered twice | One debit and a provider-compliant duplicate response |
| Bet response is lost | Original state is resolved without creating a second debit |
| Win arrives after browser logout | Correct account receives one authorized credit |
| Global round has two players | Neither player's events collide in storage or reporting |
| Round includes multiple payouts | Distinct credits, one derived round summary and no extra posting |
| Zero-value or promotional event | Contract-defined handling with no invented stake or duplicate credit |
| Correction follows settlement | Original and corrective events linked and financially reconciled |
| Signature valid but player mismatched | No posting; security audit shows the rejected scope |
| Provider event absent locally | Visible discrepancy with responsible recovery path and preserved references |
- Document the meaning and uniqueness scope of every identifier before integrating the first wallet callback.
- Exercise bet, win, duplicate, late, out-of-order and multi-event scenarios in the provider's test environment.
- Reconcile posted balance changes to provider evidence and keep unresolved events visible until reviewed.
A round groups gameplay, a bet describes a wager, and a transaction records one money-changing instruction. Keep their identifiers linked but separate. That model makes retries, payouts, corrections and reconciliation understandable even after the game session disappears.
KNOWLEDGE
Sources & further reading
This guide draws on primary technical references and official guidance. Regulatory applicability depends on jurisdiction and implementation.
- VeliGames — Seamless Wallet API and transaction semantics
- Aviatrix — Seamless Wallet backend integration
- Aviatrix — Game API and game-round results
- Tom Horn Gaming — Withdraw (Bet Request)
- Tom Horn Gaming — Deposit (Win Request)
- Naga Games — Get Bet Status from Operator
- IETF — RFC 9110 HTTP Semantics
- Stripe — Idempotent requests
- OWASP — Webhook Security Cheat Sheet
- OWASP — Logging Cheat Sheet