KNOWLEDGE WALLET & TRANSACTIONS

Rollbacks, Refunds and Interrupted Game Rounds

A game can freeze after a wallet bet has committed, but that does not automatically authorize a refund. Learn how to distinguish bet reversals, win corrections and round cancellations, preserve original postings and handle delayed responses without crediting money twice.

How to use this guide

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 rollback, a refund and a cancelled round are different instructions

A player places a bet, but the game freezes before the result appears. Should the wallet return the stake? Not automatically. The debit might never have committed; it might have committed while the game result was delayed; or the provider might already have settled the bet and lost its response. A browser interruption describes a technical symptom, not a financial instruction. Only an authenticated, contract-defined action and the authoritative transaction history can establish whether money should move.

Rollback is a reversal of a previously posted monetary movement. A stake refund is normally a credit that returns some or all of a debit. A win reversal is usually a debit that removes an earlier payout. Cancelling an entire round can involve several such movements. A partial refund might coexist with winnings that remain valid. Treating every cancellation as a full credit of the original stake produces accounting errors and, in some cases, an unauthorized gain.

InstructionPossible wallet effectImportant distinction
Reverse a recorded betCredit the previously debited amount, if permittedA posted wager must be identified first
Reverse a recorded winDebit the previously credited payoutIt is not another stake refund
Partial stake refundCredit only the authorized remaining amountExisting cash-out or payout can remain valid
Cancel an entire roundReverse the exact included postingsOne round may contain multiple debits and credits
Browser or server interruptionNo automatic money movementResolve the ledger and provider state first
Integration scope

The provider operations below are documented examples, not a statement that CASINO-AGG implements or partners with those providers. The financial meaning, authentication and exact response must be taken from the approved integration contract.

Map cancellation types before changing any balance

VeliGames documents three different cancellation actions. CANCEL_TRANSACTION reverses one referenced bet or win; CANCEL_ROUND reverses the transactions of a round; CANCEL_BET credits an explicit adjustment refund while already paid wins remain untouched. The names are meaningful within that provider's protocol. Tom Horn Gaming instead documents a RollbackTransaction method that points to a specified transaction reference. Aviatrix documents its own cancellation path through a win operation with a CancelBet meaning after unsuccessful delivery attempts. They are not interchangeable endpoints.

Public contract exampleObject being correctedDo not assume
VeliGames CANCEL_TRANSACTIONExactly one referenced bet or win postingThe target must always be a stake
VeliGames CANCEL_BETOnly adjustmentRefund amountAn earlier win is also cancelled
VeliGames CANCEL_ROUNDThe provider-defined round's monetary eventsEvery brand or game uses this same scope
Tom Horn RollbackTransactionOne transaction identified by referenceA rollback method has a universal HTTP result
Aviatrix CancelBet operationA provider-specific bet cancellation flowIts message schema matches VeliGames or Tom Horn

An adapter must translate each operation into an explicit internal intent: reverse this ledger debit, reverse this ledger credit, refund this amount or reverse this reviewed set of round postings. Validate operation type, original transaction identity, round and player ownership, amount, currency and correction reason. Keep the provider's distinct response and retry contract. Do not rename every provider method to a generic cancel and discard the fields needed for reconciliation.

An instruction can also be informational rather than monetary. A zero-value result or an updated round status should not create an invented refund. Document which provider signals are authoritative, which are hints and which require an explicit follow-up query. The implementation must reject a request that tries to reverse another operator's or another player's transaction even if the referenced ID exists.

Locate the original ledger posting before compensating it

A valid rollback request should identify a financial posting, not merely a browser session or game title. Find the original by its contract-defined provider reference and authenticated namespace, then verify whether the operator actually committed a debit or credit. The same round ID may contain several players or several transactions. Reversing the first matching record by round ID is therefore unsafe. Preserve the complete mapping of provider transaction, operator ledger posting, account, currency, amount, round and authorization scope.

01Authenticate

Verify signature or credential and bind the request to the correct provider, brand and wallet account.

02Resolve target

Locate the exact original financial transaction using its documented identity and scope.

03Validate relationship

Confirm reversal type, permitted amount, currency, ownership and any previous compensations.

04Post compensation

Commit a separate correcting ledger entry and its idempotency identity atomically.

05Reply and record

Return the provider-defined result and retain both original and correction references for audit.

If the original is missing, distinguish a transaction never accepted, a posting not yet visible, and one already archived. Do not credit money simply because the provider says cancel. Record the incoming correction with its own identity, perform a documented lookup or bounded hold, and follow the contract's not-found or retry policy. Conversely, do not assume a missing hot-cache record proves no original ledger posting exists.

A rollback should never erase or overwrite the historical debit. The ledger needs both the original movement and the linked correction so audits can show why the final balance changed. The provider and operator may have different transaction IDs: preserve the mapping instead of replacing one with the other.

Return a cancelled stake once and only once

For a simple example, a player starts with 100 units and a posted stake of 10 leaves 90. If the provider later authorizes a full reversal of that same bet, one compensating credit of 10 restores 100. A retry of the reversal must not raise the account to 110. The rollback has its own stable financial identity, references the original bet and is subject to a unique database rule. The first accepted correction determines the durable result for matching retries.

EventBalance movementBalanceLedger interpretation
Opening position0100Not a bet posting
Bet B-10 committed-1090One authorized stake debit
Rollback R-10 of B-10+10100Separate corrective credit
Retry of R-100100Original correction outcome is reused
New unrelated bet B-11Contract-definedDepends on fundsNot suppressed by the old rollback

A reversal ID and an original transaction ID serve different purposes. Reusing the original debit ID as if the refund were that same financial movement can prevent legitimate corrections or create identity collisions. Some provider contracts encode cancellation identity differently, so use a normalized internal correction key with the contract-defined scope, but always preserve the original reference. The original debit, compensating credit and final result must be independently inspectable.

Use one database transaction for checking and reserving the correction, confirming that no equivalent correction already exists, and committing the credit. If two workers process the same cancellation concurrently, both must not release funds. MySQL's InnoDB isolation and locking documentation covers relevant database behavior; the exact design depends on the wallet's account and ledger model.

A reversed win is a debit and may find insufficient funds

Imagine a 10-unit stake followed by a 25-unit payout. If the result was incorrect and the provider authorizes reversing the win, the correction removes the 25-unit credit; it does not refund the 10-unit stake. A subsequent corrected settlement may be another independent win with its own identity. VeliGames explicitly distinguishes cancellation of a referenced win from cancellation of a referenced bet and describes resettlement after an earlier round was closed.

The player may have spent the winnings before the correction arrives. Then an operator can face a balance that is too small for the reversal debit. Treat this as a defined financial exception, not a reason to fabricate an earlier balance or duplicate the correction. Some provider contracts or regulated wallet designs require a negative position, reserved funds or an external debt adjustment; others prohibit those outcomes. The operator must agree on the rule in advance and keep a traceable unresolved liability if immediate reversal is not permitted.

  • Identify the exact win posting by provider ID and its account rather than deducting a round's total payout blindly.
  • Apply the contract's full or partial reversal semantics; do not assume every correction is all-or-nothing.
  • Enforce idempotency for a win reversal independently of the original win and any subsequent replacement payout.
  • Preserve the original payout, its correction and the replacement transaction in the ledger and the reconciliation view.
  • Escalate balance-insufficient corrections through an agreed policy instead of silently deleting financial history.

An API may allow multiple legitimate resettlements of the same round. A simplistic immutable 'round closed forever' flag would reject later authorized corrections. At the same time, accepting arbitrary new win instructions on a closed round would be unsafe. Resolve the tension by following the provider's specific adjustment authorization and original transaction references.

Partial refunds must leave valid cash-outs untouched

Not every voided wager receives its entire stake back. A sportsbook may have paid a partial cash-out before the remaining exposure was cancelled. VeliGames documents a case where a 2.00 EUR stake is followed by a 1.58 EUR cash-out and then a 0.38 EUR adjustment refund. The player receives the cash-out and the remaining refundable portion; the earlier payout is not reversed. The small residual difference reflects the provider example's retained fee, not an accounting error that the wallet should silently correct.

Documented exampleBalance effectRunning net from initial balance
Accepted stake-2.00 EUR-2.00 EUR
Partial cash-out already credited+1.58 EUR-0.42 EUR
Authorized remaining refund+0.38 EUR-0.04 EUR
Incorrect additional win reversalDo not post -1.58 EURWould create an artificial loss

The values and fee treatment belong to the cited provider's example; another provider might have no fee or a different representation of outstanding liability. The general design lesson is to distinguish refunded principal, settled cash-out, previously paid wins and fees. A CANCEL_BET style refund must not be rewritten as 'reverse all transactions in the round' unless that is exactly the supported contract meaning.

Record the precise authorized refund amount and currency as immutable attributes of the correction. Check previous partial refunds so that multiple corrections do not accidentally exceed the reversible balance. Different correction references may represent successive authorized adjustments, but repeated delivery of the same correction reference is one event. Test both full and partial cash-outs, late voids and contradictory provider payloads.

Cancel a round by examining all of its financial events

A round may contain a bet, additional wagers, several wins and earlier partial corrections. Cancelling the round means finding the set of transactions included by the provider's contract, not assuming one stake and one payout. A reversal of each eligible original posting must have an auditable identity. The total round adjustment is the sum of those distinct compensations, not a fresh payment of the round's net result on top of them.

01Resolve round scope

Validate the provider, tenant, player, round ID and contract-defined financial membership.

02Enumerate original postings

Collect authoritative bet, win and correction IDs and identify which movements remain reversible.

03Build correction plan

Apply one appropriate sign and amount to each targeted debit or credit without reusing another player's global round.

04Commit safely

Use transaction boundaries or a recoverable compensation workflow for the planned changes.

05Reconcile round result

Confirm the sum of originals and corrections matches the provider's intended final financial result.

Some games share one round identifier across players, so a raw round ID is not sufficient to select account postings. In addition, a previous partial refund changes how much remains reversible. For a large or distributed set of postings, one all-or-nothing local database transaction may be impractical; use durable per-item progress and a recoverable workflow, never a best-effort loop that loses which compensations committed.

VeliGames documents a CANCEL_ROUND that reverses all transactions of the round, including wins, while its CANCEL_BET has narrower semantics. That distinction is exactly why a generic 'cancel' button cannot be translated into a universal wallet balance change.

An interrupted game must be investigated before refunding

The game window closes, the device loses power or an iframe shows an error. These events are not sufficient evidence that a round was void. The provider may hold the authoritative game outcome, the bet may have been accepted, and a win may arrive after the browser session is gone. Returning funds automatically from a front-end error can create a duplicate credit if settlement subsequently completes. The wallet should preserve the authorized bet and ask the appropriate provider status or recovery interface what happened.

Observed failureUnsafe assumptionResolution
Browser closes during spinThe stake must be refundedLook up authoritative round or transaction outcome
Wallet response lost after bet debitThe bet never happenedResolve original debit by its stable transaction ID
Provider rejects or voids a roundAny amount may be creditedApply only the authorized correction with its reference
Win arrives after session expiryLate payout is invalidAuthenticate and settle according to the provider's wallet contract
No result appears in a report yetThe round is definitively cancelledUse bounded pending status and reconciliation escalation

Aviatrix documents retrying certain wallet requests with increasing delays and invoking a specific bet-cancellation operation if all delivery attempts fail. VeliGames documents that wins and cancellations may still be processed after a session identifier expires. These contracts show why one cannot use browser uptime or session validity as the universal financial cutoff. Check the correct provider's settlement and cancellation rules before changing money.

An unresolved round should have a controlled status and investigation path, not endless silent retries. Support staff need the operator, player, original bet, game, round, timestamps, provider responses and available outcome evidence. Access to those records must be limited, with sensitive credentials redacted.

Treat round closure and final money settlement as separate facts

A round can appear finished to the player while a correction remains possible under the provider contract. VeliGames documents sports resettlement in which an earlier win is reversed and a new adjusted win arrives, sometimes after an earlier closed status. Conversely, its documentation cautions that a roundClosed flag in ordinary casino integrations may have different meanings. Closure is therefore not a universal ban on later authorized financial messages.

An implementation should keep separate evidence for presentation state, provider round status, transaction finality and reconciliation completion. Accept only documented late operations with the necessary authorization and references. A genuinely duplicate old rollback must still resolve to its original recorded outcome, even when a replacement settlement has since arrived. Never treat a newly received correction as valid solely because it has a fresh timestamp.

  • Do not derive financial finality from an iframe close event or a generic UI round-complete message.
  • Retain prior transaction and compensation IDs across relaunch, logout and provider adjustment windows.
  • Distinguish a corrected win from a retransmission of the previous win using the provider's financial identities.
  • Keep explicit permission and validation rules for reopening and resettling an earlier closed round.
  • Report unresolved financial status separately from the player's visual game-session status.

Make compensation idempotent, authenticated and recoverable

The exact problem that causes a double bet debit can also cause a double refund. After a correction commits, its acknowledgment may be lost and the provider can retry. Use a stable correction identity with a database uniqueness rule and immutable comparison of original transaction, type, amount, currency and owner. The rollback ledger posting and recorded result should commit together. If the second request changes those fields under the same identity, treat it as a conflict and do not post a new credit or debit.

Authenticate every cancellation callback before looking up a target posting or returning transaction details. An attacker who learns a reference must not be able to request a refund for a different account. Signature replay controls and financial idempotency are complementary: OWASP's webhook guidance distinguishes delivery authenticity and event deduplication. Keep corrections separate from manual support adjustments, with approval and audit controls appropriate to the operating environment.

When financial action spans independent services, a failed step cannot always be undone by a single database rollback. AWS's saga guidance describes local transactions with compensating actions and explicit recovery. An operator wallet might use durable queues, a transactional outbox or a staged reconciliation workflow. Whatever the implementation, it must record which compensation steps committed before retrying them and must not promise instantaneous atomic rollback of the remote provider's database.

No silent correction

Do not overwrite the initial stake, create a free-floating credit or discard a failed compensation. Every monetary adjustment needs a documented authority, unique identity, original reference, resulting state and path to reconciliation.

Verify interrupted rounds and reversals against the ledger

A safe launch requires proof of the whole chain: provider instruction, original wallet posting, cancellation authorization, correction posting, resulting balance and provider acceptance. A test that merely shows 'refund succeeded' on screen is insufficient. Run concurrent and delayed retries, crash a worker around commit, and compare actual ledger entries with the provider's status or report. Keep an investigation owner for events that remain unmatched.

Acceptance caseExpected evidence
Full reversal of one posted betOne credit equal to authorized stake; original debit retained
Same rollback delivered twiceOnly one corrective posting; documented duplicate response
Correction references a winCorrectly authorized debit of prior credit, not another stake refund
Partial refund after cash-outOnly residual amount refunded; earlier payout retained
Global round with two playersNo correction of another player's balance
Cancel request before original becomes visibleNo blind credit; documented hold, status query or refusal
Game iframe closes mid-roundNo automatic refund without provider-confirmed financial outcome
Win or correction after session expiryAuthorized late event handled by the correct provider rule
Corrected settlement after round closeOriginal, reversal and new win all separately traceable
Provider and wallet totals disagreeException recorded with references, amount, status and investigation owner

Track correction latency, duplicate and conflicting reference counts, missing originals, pending cancel operations, exhausted retries, negative-balance exceptions and unreconciled amounts. Preserve minimal, access-controlled evidence; OWASP logging guidance is useful for keeping secrets and unnecessary player details out of logs. Financial correctness is proven by matched postings and authorized compensations, not by the absence of visible browser errors.

Release gate

Before production, require signed-off behavior for full, partial and win reversals; duplicate rollback retries; late and out-of-order messages; interrupted sessions; insufficient available funds; and a reproducible end-to-end reconciliation report.

KNOWLEDGE

Sources & further reading

This guide draws on primary technical references and official guidance. Regulatory applicability depends on jurisdiction and implementation.

  1. VeliGames — Seamless Wallet API and cancellation semantics
  2. Tom Horn Gaming — RollbackTransaction
  3. Aviatrix — Backend integration and wallet cancellation
  4. AWS Prescriptive Guidance — Saga pattern
  5. AWS Builders' Library — Making retries safe with idempotent APIs
  6. MySQL 8.4 — InnoDB Transaction Isolation Levels
  7. OWASP — Webhook Security Cheat Sheet
  8. IETF RFC 9110 — HTTP Semantics
  9. AWS Well-Architected — Control and limit retry calls
  10. OWASP — Logging Cheat Sheet