GAP — Integrating Sports via GAP
Overview
This section contains API requests required to integrate sports betting through GAP. It facilitates seamless communication between the operator and GAP, ensuring secure and efficient data exchange.
Key Features
- RSA-SHA256 Signature Verification for secure communication
- Wallet API Support for transactions (bets, rollbacks, winnings, balance)
- Real-Time Sports Event Handling
- Full compliance with GAP's API specifications
Endpoints Included
- Authentication – Obtain API tokens for secure access
- Balance Inquiry – Retrieve user balance before placing bets
- Bet Placement – Register a new sports bet transaction
- Bet Rollback – Cancel or reverse a bet due to errors
- Bet Void – Cancel or reverse a bet due to errors
- Bet Result – Process winnings after event completion
- Event Updates – Receive updates for ongoing and completed sports events
- Transaction Verification – Validate bet integrity using GAP's verification process
Use Cases to be supported for integration
| Use Case |
|---|
| Bet Placement - Result (WON) - Rollback - Result (LOST) |
| Bet Placement - Result (LOST) - Rollback - Result (WON) |
| Bet Placement - Result (LOST) - Rollback - VOID |
| Bet Placement - Result (WON) - Rollback - VOID |
| Bet Placement - VOID |
Result / VOID is the end state for any transaction
Bet Lifecycle Examples
1. Bet Placement
Since the exchange bets are handled through SAP, there are some additional fields we need to handle in bet requests like betType, eventName, marketName, runnerName, transaction id etc.
Whenever a bet is placed, a transaction id will be generated for that particular bet and it is unique for each bet, you can use this transaction id to refer to any specific bet.
Example bet placement request:
{
"betType": "Sports",
"debitAmount": 100,
"eventName": "DJOKOVIC, NOVAK 2010S vs. NADAL, RAFAEL 2010S",
"exposure": 0,
"exposureEnabled": false,
"exposureTime": 0,
"gameId": "550003",
"marketId": "",
"marketName": "1st set game 2 - 1st point",
"operatorId": "demo-op",
"reqId": "fe7afd47-a6a8-4c28-8287-3addd8ac8d0c",
"roundId": "218:sp:setnr=1|gamenr=2|pointnr=1",
"round_closed": false,
"runnerName": "DJOKOVIC, NOVAK 2010S",
"token": "0aded45c-2fc1-40ce-809e-8af7aef9d9ae",
"transactionId": "52f866bb-0b78-42fe-bfc2-4c50f218b5f9",
"userId": "42871"
}
2. Bet Result
The result was declared and bet got settled, now the request looks like below:
{
"betType": "Sports",
"creditAmount": 150,
"eventName": "DJOKOVIC, NOVAK 2010S vs. NADAL, RAFAEL 2010S",
"exposure": 0,
"exposureEnabled": false,
"exposureTime": 0,
"gameId": "550003",
"marketId": "",
"marketName": "1st set game 2 - 1st point",
"operatorId": "demo-op",
"profitLoss": 0,
"reqId": "e5960547-a09c-4cb7-9d23-f21758574168",
"resultInfo": null,
"roundId": "218:sp:setnr=1|gamenr=2|pointnr=1",
"round_closed": false,
"runnerName": "DJOKOVIC, NOVAK 2010S",
"token": "0aded45c-2fc1-40ce-809e-8af7aef9d9ae",
"transactionId": "52f866bb-0b78-42fe-bfc2-4c50f218b5f9",
"userId": "42871"
}
3. Bet Rollback
Now, let's assume the result declared was wrong, so in this case rollback action will be performed on a settled bet.
Example rollback request:
{
"betType": "Sports",
"eventName": "DJOKOVIC, NOVAK 2010S vs. NADAL, RAFAEL 2010S",
"exposure": 0,
"exposureEnabled": false,
"exposureTime": 0,
"gameId": "550003",
"marketId": "",
"marketName": "1st set game 2 - 1st point",
"operatorId": "demo-op",
"reqId": "46a6b2c5-c852-4a40-a28b-48d3f3fa9909",
"rollbackAmount": -150,
"roundId": "218:sp:setnr=1|gamenr=2|pointnr=1",
"round_closed": false,
"runnerName": "DJOKOVIC, NOVAK 2010S",
"token": "0aded45c-2fc1-40ce-809e-8af7aef9d9ae",
"transactionId": "52f866bb-0b78-42fe-bfc2-4c50f218b5f9",
"userId": "42871"
}
4. Bet Void
When an invalid bet is found, VOID action will be performed on that bet. Void is the end state of the bet.
We can void a bet from an open state. Also, if a bet is already settled then rollback action will be performed on that bet and after that void action will be done on that bet.
Example void request:
{
"betType": "Sports",
"eventName": "South Africa Masters v Sri Lanka Masters",
"exposure": 0,
"exposureEnabled": false,
"exposureTime": 0,
"gameId": "551001",
"marketId": "",
"marketName": "Bookmaker",
"operatorId": "hypexexchfeature",
"reqId": "2269e65d-6b7d-47fb-b4f2-19be5de231a9",
"rollbackAmount": 100,
"roundId": "259030",
"round_closed": false,
"runnerName": "Sri Lanka Masters",
"token": "36632309-8745-45f8-9f79-6f93aacfd188",
"transactionId": "b27569ce-fdf0-4e1f-8585-f77e09a5d80d",
"userId": "42871"
}
Sample Sports Login Request
curl --location 'https://dev-api.dreamdelhi.com/api/operator/login' \
--header 'Signature: byMYoU1abC/86EVvEbwNtumfgZnlbGaAwbeJ3qu668RCZRnkFv8B3fCRAzM9rDnDdjommrhK0B3BVmbpdCv6UzyY1avfxE2lbihvrF/LMkY4oKOyL8IJuGBbSLgzpI+hKYzcb+qD/En9ZAH0V4gNXh6RqI/XIgfWhB55zF9pBs4=' \
--header 'Content-Type: application/json' \
--data '{
"operatorId": "xyz",
"userId": "xyz_user_id",
"providerName": "SAP",
"platformId": "desktop",
"currency": "INR",
"clientIp": "1.1.1.1",
"username": "xyzuser",
"lobby": false,
"gameId": "550000"
}'
Example Response (200 OK)
{
"userId": "xyz_user_id",
"token": "aacc679a-567b-4d99-ae4a-ed6a872fcf02",
"url": "https://dev-sports-v3.mysportsfeed.io/auth?token=b15965ac-27d6-4d9e-b28c-b28ce8e5b078&operatorId=gaptestsb:HypexDemo&partnerId=GAPID01&providerId=SportRadar&lobby=SportBook¤cy=INR&rate=1.00&tid=&sportId=&competitionId=&eventId=",
"providerId": "xyz",
"providerName": "",
"status": 0,
"errorDescripion": "Completed successfully"
}