Wager And Result

Wager And Result Transaction

Info

The Wager And Result transaction combines the Wager and Result operations into a single call, allowing a bet to be placed and the outcome reported simultaneously.

Overview

The Wager And Result method is an optimization that allows game providers to perform both a wager and a result operation in a single transaction. This is particularly useful for instant games where the outcome is determined immediately after the player places a bet, such as scratch cards or simple slot spins.

By combining these operations, the game can reduce latency and network traffic, resulting in a smoother player experience. Like individual Wager and Result transactions, Wager And Result implements idempotency controls to prevent duplicate processing.

Warning

**Important:** Wager And Result requests implement idempotency controls. If a duplicate request is received with the same transaction ID, the system must return the original response with status code 200 and the "Success - duplicate request" status.

Flow Diagram

sequenceDiagram participant Player participant Game as Game Provider participant Groove as Groove Platform participant Casino as Casino Operator Player->>Game: Place Bet & Complete Game Round Game->>Groove: Wager And Result Request Groove->>Casino: Forward Wager And Result Request Casino->>Casino: Validate Session Casino->>Casino: Check Available Funds Casino->>Casino: Check Idempotency Casino->>Casino: Process Wager Casino->>Casino: Process Result Casino->>Casino: Update Final Balance Casino->>Groove: Wager And Result Response Groove->>Game: Forward Response Game->>Player: Display Outcome & Updated Balance

Casino Responsibilities

The casino platform must perform the following operations when processing a Wager And Result request:

  1. Session Validation

    • Confirm the incoming game session ID is valid
    • Verify the session is associated with the provided account ID
  2. Transaction Validation

    • Verify sufficient funds are available for the wager
    • Check that the player is within responsible gaming limits
    • Determine if the transaction has already been processed
  3. Idempotency Check

    • Check if a request with the same transactionid has been processed before
    • If any essential fields mismatch, return “Transaction operator mismatch”
    • If no mismatches, return the original response with status “200 Success - duplicate request”
  4. Transaction Processing

    • Process the wager (deduct the bet amount from player balance)
    • Process the result (add the win amount to player balance)
    • Calculate the final player balance

Request Details

Endpoint

/groove?request=wagerAndResult&[parameters]

Request Parameters

Parameter Data type Required Description
accountid String(60) -[0-9a-zA-Z] Yes Player’s unique identifier
Example: 5179068
apiversion String Yes API version
Example: 1.2
betamount Decimal (32,10) Yes Wager amount (real + bonus funds)
Examples: 2.00, 0.40, 0.01
device String Yes Player’s device type
Valid values: desktop, mobile
gameid String Yes Groove game ID
Example: 80102
gamesessionid String(64) Yes Game session ID
Example: 11_99d71938-c2d9-4844-b950-d598c2es
gamestatus String Yes Game status
Valid values: completed, pending
request String Yes Request method name
Value: wagerAndResult
result Decimal (32,10) Yes Win amount
Example: 2.25
roundid String(255) Yes Round identifier
Example: 802d1812c32686748f2afbcacfcc82114cf
transactionid String(255) Yes Unique transaction identifier
Example: 7617edd0924c11e7abb2865556898ad0re
frbid String(255) No Free Round Bonus ID (if applicable)
Example: 12a345b78

Example Request

GET {casino_endpoint}?request=wagerAndResult&gamesessionid=123_jdhdujdk&accountid=111&device=desktop&gameid=80102&apiversion=1.2&result=10.0&betamount=5.0&roundid=nc8n4nd87&transactionid=trx_id&gamestatus=completed

Response Details

Response Parameters

Parameter Data type Required Description
apiversion String Yes API version
Example: 1.2
balance Decimal (32,10) Yes Total player balance (real + bonus)
Examples: 500.00, 140.25
bonus_balance Decimal (32,10) Yes Player’s bonus balance
Example: 50.00
bonusmoneybet Decimal (32,10) Yes Portion of bet from bonus funds
Example: 0.00
bonusWin Decimal (32,10) Yes Portion of win allocated to bonus funds
Example: 0.00
code Integer Yes Response code (see Appendix)
Example: 200
real_balance Decimal (32,10) Yes Player’s real money balance
Example: 100.00
realmoneybet Decimal (32,10) Yes Portion of bet from real money
Example: 5.00
realMoneyWin Decimal (32,10) Yes Portion of win allocated to real money
Example: 10.00
status String Yes Response status (see Appendix)
Example: Success
walletTx String(50) Yes Casino’s wallet transaction ID
Example: de73550e-0612-4a1b-8a0d-a5a3745b
game_mode Integer Yes* Game mode:
1 - Real money mode
2 - Bonus mode
*Required for CMA-compliant games
order String Yes* Order type:
cash_money - Real money
bonus_money - Bonus money
*Required for CMA-compliant games
Note

**Note:** The sum of `bonusmoneybet` and `realmoneybet` must equal the total `betamount` specified in the request. Similarly, the sum of `bonusWin` and `realMoneyWin` must equal the total `result` amount. If your casino does not use bonuses, set `bonusmoneybet` and `bonusWin` to 0.

Example Success Response

{
  "code": 200,
  "status": "Success",
  "walletTx": "de73550e-0612-4a1b-8a0d-a5a3745b",
  "balance": 105.00,
  "bonusWin": 0.00,
  "realMoneyWin": 10.00,
  "bonusmoneybet": 0.00,
  "realmoneybet": 5.00,
  "bonus_balance": 50.00,
  "real_balance": 55.00,
  "game_mode": 1,
  "order": "cash_money",
  "apiversion": "1.2"
}

Error Handling

Common Error Codes

The error codes for Wager And Result are the same as those used in the individual Wager and Result transactions.

Code Status Description
1 Technical error Internal server error
110 Operation not allowed Invalid session, account, negative amount, etc.
400 Transaction operator mismatch Transaction belongs to a different operator
409 Round closed or transaction ID exists The round is already closed or this transaction ID has been used
1000 Not logged on Player session is invalid or expired
1006 Out of money Insufficient funds to place the wager
1019 Gaming limit Player has exceeded betting limits
1035 Account blocked Player account is suspended or blocked
Tip

For a complete list of error codes, refer to [Appendix A: Transaction Response Status Codes](/appendix-a-transaction-response-status-codes/).

Implementation Notes

  1. Use Cases:

    • Instant win games (scratch cards, simple slots)
    • Games where the outcome is determined immediately after the bet
    • Optimizations to reduce latency and improve player experience
  2. Idempotency Handling:

    • Store transaction IDs to identify duplicate requests
    • Return the original response for duplicate transactions with the same transaction ID
    • Only the balance fields may change in duplicate responses
  3. Balance Calculation:

    • The final balance should reflect both the wager deduction and result addition
    • Example: Initial balance 100.00, bet 5.00, win 10.00, final balance 105.00
  4. Game Status:

    • If gamestatus is “completed”, mark the round as closed
    • If gamestatus is “pending”, the round remains open for additional Result transactions
  5. Free Round Bonus:

    • For FRB games, the betamount is typically 0
    • Include the frbid parameter to identify which bonus is being used

Advantages Over Separate Calls

  1. Reduced Latency: Single network round-trip instead of two
  2. Simplified Error Handling: One transaction to track and manage
  3. Atomic Operation: Either both wager and result succeed, or neither does
  4. Improved Player Experience: Faster game play with immediate results

Security

When Signature Validation is enabled:

  1. Include the X-Groove-Signature header in your request
  2. Calculate signature using query parameters (excluding request)
  3. Include frbid parameter if present (for free round bonuses)
  4. See Signature Validation for detailed implementation

Signature Example

For the request:

GET {casino_endpoint}?request=wagerAndResult&gamesessionid=123_jdhdujdk&accountid=111&device=desktop&gameid=80102&apiversion=1.2&betamount=10.0&result=10.0&roundid=nc8n4nd87&transactionid=trx_id

Query parameters for signature (alphabetically sorted):

  • accountid: “111”
  • apiversion: “1.2”
  • betamount: “10.0”
  • device: “desktop”
  • gameid: “80102”
  • gamesessionid: “123_jdhdujdk”
  • result: “10.0”
  • roundid: “nc8n4nd87”
  • transactionid: “trx_id”

Concatenated values: 1111.210.0desktop80102123_jdhdujdk10.0nc8n4nd87trx_id

With security key "test_key", the signature would be:

X-Groove-Signature: bba4df598cf50ec69ebe144c696c0305e32f1eef76eb32091585f056fafd9079
  • Wager - Separate endpoint for placing a bet
  • Result - Separate endpoint for reporting game outcome
  • Rollback - Used to reverse a transaction if needed