Wager And Result
Wager And Result Transaction
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.
**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
Casino Responsibilities
The casino platform must perform the following operations when processing a Wager And Result request:
-
Session Validation
- Confirm the incoming game session ID is valid
- Verify the session is associated with the provided account ID
-
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
-
Idempotency Check
- Check if a request with the same
transactionidhas 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”
- Check if a request with the same
-
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
?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 | 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=completedResponse 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 mode2 - Bonus mode*Required for CMA-compliant games |
| order | String | Yes* | Order type:cash_money - Real moneybonus_money - Bonus money*Required for CMA-compliant games |
**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 |
For a complete list of error codes, refer to [Appendix A: Transaction Response Status Codes](/appendix-a-transaction-response-status-codes/).
Implementation Notes
-
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
-
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
-
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
-
Game Status:
- If
gamestatusis “completed”, mark the round as closed - If
gamestatusis “pending”, the round remains open for additional Result transactions
- If
-
Free Round Bonus:
- For FRB games, the
betamountis typically 0 - Include the
frbidparameter to identify which bonus is being used
- For FRB games, the
Advantages Over Separate Calls
- Reduced Latency: Single network round-trip instead of two
- Simplified Error Handling: One transaction to track and manage
- Atomic Operation: Either both wager and result succeed, or neither does
- Improved Player Experience: Faster game play with immediate results
Security
When Signature Validation is enabled:
- Include the
X-Groove-Signatureheader in your request - Calculate signature using query parameters (excluding
request) - Include
frbidparameter if present (for free round bonuses) - 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_idQuery 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