CmsWager Integration Document
  • Introduction
  • Before Start
  • Sportsbook UI
    • Integration
    • Window Message Events
  • CmsWager Api
    • Summary
    • Authentication
    • API Reference
      • Login/Register User
      • Freebet and Bonus assignment
    • Errors
  • Client API Reference
    • Summary
    • Api Reference
      • Bet placement
      • Cancelling bets
      • Concluding bets
      • Reopening concluded bets
      • Partial Cashout
      • Insurance
  • Frontend Api (optional)
    • Summary
    • Api Reference
      • Components
        • Top Leagues
        • Prematch Active Sports
        • Prematch Sport Menu
        • Last minute
        • Live now (reduced)
      • Matches
        • Tournament Odds
        • Match Odds
  • Appendix
    • Transaction types
    • Bet Status
    • Bet Type
    • Error Codes
Powered by GitBook
On this page
  • Ticket reserve:
  • Ticket rollback
  • Ticket Confirm
  1. Client API Reference
  2. Api Reference

Bet placement

Ticket reserve:

POST {clientApi}/ticket/reserve When placing a bet, the CmsWager system will send this request to the client system to check if the user has enough balance to play the bet

Example Request

{
    "clientId": "xyzk",
    "userId": 123456,
    "transactionType": 2,
    "amount": 10.56,
    "ticket": {
        "code": "abcd1234",
        "isBonus": false,
        "amount": 10.56
    }
}

Example Success Response

Response code 200

If the user has sufficient balance, the withdraw amount in the request must be deducted from the user, and a record should be created, with the specific 'code' under ticket.

After the withdraw amount is deducted and a record is successfully created, a 200 success response should be returned.

{    
    "status": "success",
    "balance": 140.85,
    "error_code": 0,
    "error_message": ""
}

Example Failure Response

Response code 406

If the user has insufficient balance, no actions should be taken, and a 406 response with 2001 error_code should be returned.

{
    "status": "error",
    "balance": 140.85,
    "error_code": 406,
    "error_message": "Not enough balance"
}

Ticket rollback

POST {clientApi}/ticket/rollback

Sometimes, a server error may occur on each side during `ticket/reserve` request, due to a gateway timeout, or a technical issue. Also, the ticket may just get rejected by the user's risk limits and fail to successfully create. In this case, the CmsWager system will send a rollback request with the same ticket code of "reserve" request to prevent discrepancies.

If this request encounters a server error, it will be retried for 24 hours until it gets a meaningful response

If the rollback request is received more than one time and it was just processed, the client system does not need to change the user balance and a success response must be returned

Example Request

{
    "clientId": "xyzk",
    "userId": 123456,
    "transactionType": 1,
    "amount": 10.56,
    "ticket": {
        "code": "abcd1234",       
        "amount": 10.56
    },
    "code": 2020,
    "reason":"ticket_rejected"
}

Example Success response

Response code 200

Success response must be returned in these cases: if a record is found and the status is not setted to "rollbacked". If a record is not found: it mean that the reserve request was not processed and client system does not need to modify the user balance

{    
    "status": "success",
    "balance": 140.85,
    "error_code": 0,
    "error_message": ""
}

Example Failure response

Response code 406

{    
    "status": "error",
    "balance": 140.85,
    "error_code": 406,
    "error_message": "generic error"
}

Ticket Confirm

POST {clientApi}/ticket/confirm

If the ticket/reserve request returns a success response, and the bet is successfully created with no problems, a `ticket/confirm` request will be sent by the CmsWager system, to the client system.

This request may bring a lower stake amount compared to 'reserve' request. This is caused by risk limits and counter offers. If that is the case, the difference (amount indicated by "deposit" key inside the request) should be refunded to the user.

If this request encounters a server error, it will be retried for 24 hours until it gets a meaningful response.

If the "ticket confirm" request is received more than one time and it was just processed, a success response must be returned

Example Request with same amount of reserve

{
    "clientId": "xyzk",
    "userId": 123456,
    "transactionType": 0,
    "amount": 0,
    "ticket": {
        "id": 123456,
        "code": "abcd1234",
        "isBonus": false,
        "isFreebet": false,
        "freebetId": 0,
        "ticketType": 3,
        "amount": 10.56,
        "minAccumulator": 2.26,
        "maxAccumulator": 11.60,
        "minBonus": 2.60,
        "maxBonus": 5.20,
        "minWin": 10.56,
        "maxWin": 10.56,
        "combinations": 7
        "odds": [
            {
                "banker": false,
                "isLive": false,
                "status": 0,
                "match": {
                    "id": 56963,
                    "home": "Italy",
                    "away": "England",
                    "matchDate": "2024-01-10T18:30:00.000Z"
                },
                "odd": {
                    "id": "56s2685d",
                    "name": "home",
                    "oddValue": 2.56
                },
                "market": {
                    "id": 123,
                    "name": "1x2"
                },
                "sport": {
                    "id": 1,
                    "name": "Soccer"
                },
                "category": {
                    "id": 20,
                    "name": "International"
                },
                "tournament": {
                    "id": 22,
                    "name": "Euro 2020"
                }
            },
            {
                "banker": false,
                "isLive": false,
                "status": 0,
                "match": {
                    "id": 56964,
                    "home": "Spain",
                    "away": "France",
                    "matchDate": "2024-01-10T18:30:00.000Z"
                },
                "odd": {
                    "id": "df8522s",
                    "name": "home",
                    "oddValue": 2.56
                },
                "market": {
                    "id": 123,
                    "name": "1x2"
                },
                "sport": {
                    "id": 1,
                    "name": "Soccer"
                },
                "category": {
                    "id": 20,
                    "name": "International"
                },
                "tournament": {
                    "id": 22,
                    "name": "Euro 2020"
                }
            }
        ],
        "ticketSystem": [
            {
                "code": 1,
                "combinations": 3,
                "TotalStake": 3.0,
                "minWin": 1.39,
                "maxWin": 4.97
            },
            {
                "code": 2,
                "combinations": 3,
                "TotalStake": 3.0,
                "minWin": 1.9738,
                "maxWin": 8.0434
            },
            {
                "code": 3,
                "combinations": 1,
                "TotalStake": 1.0,
                "minWin": 4.263408,
                "maxWin": 4.263408
            }
        ]
    }
}

Example Request with different amount of reserve

in this case the "transactionType" value is "1" and the amount value in root is different from "0". The amount should be refunded to user.

{
    "clientId": "xyzk",
    "userId": 123456,
    "transactionType": 1,
    "amount": 5.60,
    "ticket": {
        "id": 123456,
        "code": "abcd1234",
        "isBonus": false,
        "isFreebet": false,
        "freebetId": 0,
        "ticketType": 3,
        "amount": 10.56,
        "minAccumulator": 2.26,
        "maxAccumulator": 11.60,
        "minBonus": 2.60,
        "maxBonus": 5.20,
        "minWin": 10.56,
        "maxWin": 10.56,
        "combinations": 7
        "odds": [
            {
                "banker": false,
                "isLive": false,
                "status": 0,
                "match": {
                    "id": 56963,
                    "home": "Italy",
                    "away": "England",
                    "matchDate": "2024-01-10T18:30:00.000Z"
                },
                "odd": {
                    "id": "56s2685d",
                    "name": "home",
                    "oddValue": 2.56
                },
                "market": {
                    "id": 123,
                    "name": "1x2"
                },
                "sport": {
                    "id": 1,
                    "name": "Soccer"
                },
                "category": {
                    "id": 20,
                    "name": "International"
                },
                "tournament": {
                    "id": 22,
                    "name": "Euro 2020"
                }
            },
            {
                "banker": false,
                "isLive": false,
                "status": 0,
                "match": {
                    "id": 56964,
                    "home": "Spain",
                    "away": "France",
                    "matchDate": "2024-01-10T18:30:00.000Z"
                },
                "odd": {
                    "id": "df8522s",
                    "name": "home",
                    "oddValue": 2.56
                },
                "market": {
                    "id": 123,
                    "name": "1x2"
                },
                "sport": {
                    "id": 1,
                    "name": "Soccer"
                },
                "category": {
                    "id": 20,
                    "name": "International"
                },
                "tournament": {
                    "id": 22,
                    "name": "Euro 2020"
                }
            }
        ],
        "ticketSystem": [
            {
                "code": 1,
                "combinations": 3,
                "TotalStake": 3.0,
                "minWin": 1.39,
                "maxWin": 4.97
            },
            {
                "code": 2,
                "combinations": 3,
                "TotalStake": 3.0,
                "minWin": 1.9738,
                "maxWin": 8.0434
            },
            {
                "code": 3,
                "combinations": 1,
                "TotalStake": 1.0,
                "minWin": 4.263408,
                "maxWin": 4.263408
            }
        ]
    }
}

Example Success Response

Response code 200

If the ticket is saved successfully in client system, the bet placement operation can be considered concluded. A 200 response with "success" status should be returned.

{    
    "status": "success",
    "balance": 140.85,
    "error_code": 0,
    "error_message": ""
}

Example Failure Response

Response code 406

{    
    "status": "error",
    "balance": 140.85,
    "error_code": 2040,
    "error_message": "generic error"
}

Important: No further action should be taken on the ticket until the "ticket confirm" message has been processed.

PreviousApi ReferenceNextCancelling bets

Last updated 1 month ago