Wager
Wager Transaction
The Wager transaction is used to place a bet on behalf of a player. This transaction deducts funds from the player's balance at the casino.
Overview
The Wager method represents a player placing a bet in a game. When a player initiates a betting action, the game provider sends a Wager request to the Tech Fusion platform, which then forwards it to the casino operator. The casino processes the request by validating the player’s session, checking available funds, and updating the player’s balance accordingly.
**Important:** Wager requests implement idempotency controls. This means the same wager request should only be processed once. If a duplicate request is received, 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 request:
-
Session Validation
- Confirm the incoming game session ID is valid
- Verify the session is associated with the provided account ID
- Reject the wager if validation fails
-
Transaction Validation
- Verify sufficient funds are available
- 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 (
transactionid,accountid, orbetamount), return “Transaction parameter mismatch” - If no mismatches, return the original response with status “200 Success - duplicate request”
- Check if a request with the same
-
Transaction Storage
- Store transaction details to handle future Result and Rollback calls
- Important fields to store:
gamesessionid,accountid,roundid,transactionid, andbetamount
Request Details
Endpoint
{casino_endpoint}?request=wager&[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 from start game method Example: 11_99d71938-c2d9-4844-b950-d598c2es |
| request | String | Yes | Request method name Value: wager |
| 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=wager&gamesessionid=123_jdhdujdk&accountid=111&device=desktop&gameid=80102&apiversion=1.2&betamount=10.0&roundid=nc8n4nd87&transactionid=trx_idResponse Details
Response Parameters
| Parameter | Data type | Required | Description |
|---|---|---|---|
| accounttransactionid | String(50) | Yes | Casino’s internal transaction ID Example: 7617edd0924c11e7abb2865556898ad0 |
| 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 |
| 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: 10.00 |
| status | String | Yes | Response status (see Appendix) Example: Success |
| 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. If your casino does not use bonuses, set `bonusmoneybet` to 0.
Example Success Response
{
"code": 200,
"status": "Success",
"accounttransactionid": "aaaaaaa",
"balance": 100.00,
"bonusmoneybet": 0.00,
"realmoneybet": 10.00,
"bonus_balance": 50.00,
"real_balance": 50.00,
"game_mode": 1,
"order": "cash_money",
"apiversion": "1.2"
}Error Handling
Common Error Codes
| Code | Status | Description |
|---|---|---|
| 1 | Technical error | Internal server error |
| 110 | Operation not allowed | This error occurs when: • The wager amount is negative • Player account not found • Account ID doesn’t match session ID |
| 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: • Loss limit exceeded • Overall bet limit exceeded |
| 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
-
Idempotency Handling:
- Always 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 (as player balance may have changed due to other transactions)
-
Transaction Storage:
- Store wager details to validate future Result and Rollback calls
- Key data includes: session ID, account ID, round ID, transaction ID, and bet amount
-
Error Handling:
- Return appropriate error codes based on validation results
- Include detailed error messages for troubleshooting
-
Free Round Bonuses:
- If the wager is part of a Free Round Bonus, include the
frbidparameter - For FRB wagers, the bet amount is typically 0 in real money mode
- If the wager is part of a Free Round Bonus, include the
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=wager&gamesessionid=123_jdhdujdk&accountid=111&device=desktop&gameid=80102&apiversion=1.2&betamount=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”roundid: “nc8n4nd87”transactionid: “trx_id”
Concatenated values: 1111.210.0desktop80102123_jdhdujdknc8n4nd87trx_id
With security key "test_key", the signature would be:
X-Groove-Signature: f6d980dfe7866b6676e6565ccca239f527979d702106233bb6f72a654931b3bcRelated Endpoints
- Result - Used after a wager to add winnings to the player’s balance
- Wager and Result - Combined operation for immediate bet and win
- Rollback - Used to reverse a wager transaction if needed