Partial Cashout
Partial cashout is a process where a user does not get the full cashout amount, instead gets a portion of that amount, and the system automatically makes a new bet with the remaining amount. The new bet is identical to the cashed out bet, except the stake.
Parital cashout consists of 2 separate processes. First, the full cashout amount of the bet is deposited to the user (regardless of the partial cashout amount), and immediately after that, a new bet is created using the difference between normal cashout amount and the specified partial cashout amount.
There are 4 requests that play a role on keeping this process smooth and sychronized.
Ticket Partial Cashout
POST
{clientApi}/ticket/partial-cashout
For first, a "partial cashout" request is sent to the client system. If the client accepts the cashout, the bet is cashed out, and a new bet is created on the CmsWager side.
"Ticket partial cashout" request will be sent only for tickets with status equal to "0" (in running). If the ticket status on client side is different from "0" please response with failiure "406" code.
Example request
Example Success Response
Response code
200
If the request is successfully pocessed in client system and the deposit amount (if present) was added to user balance, a 200 response should be returned
Example Failure Response
Response code
406
If there is any error in client system, a 406 response cose should be returned
Partial Cashout Rollback
POST
{clientApi}/ticket/rollback-partial-cashout
A server error may occur on both side during "partial cashout` request.
In this case, CmsWager system can't know if the bet was cashed out. To prevent discrepancies, if the partial-cashout request does not get a meaningful response (Like a success response, or a client error indicating the bet cant be cashed out for whatever reason) The CmsWager system will send a "rollback" request to revert the actions taken.
The amount must be deducted from user balance only if the bet was successfully cashed out on the client system.
If the new status (in request) is the same of the client system, no action need to be taken in client system and a 200 response must be returned.
Example Request
Example Success Response
Response code
200
If the bet is not cashed out in the first place, this means all is good, and there is no need for a rollback. A success response can be returned.
If the bet is cashed out, the bet should move back to the RUNNING state, and the balance that was deposited to the user should be withdrawn.
Example Failure Response
Response code
406
If there is any error in client system, a 406 response cose should be returned
Ticket Partial Placement
POST
{clientApi}/ticket/partial-placement
After the new bet is created on CmsWager side, this new bet is also sent to the client system via "partial-placement" request. The player gets the response on the UI based on the response of this request.
Example Request
Example Success Response
Response code
200
If the user has sufficient balance (which they should, since they should have received a higher amount than the required amount just moments ago, with the 'partial-cashout' request), the withdraw amount in the request must be deducted from the user, and a record should be created, with the specific 'id' under ticket.
After the withdraw amount is deducted and a record is successfully created, a 200 success response should be returned.
Example Failure Response
Response code
406
In case of failure on this request, the new ticket that was created on CmsWager side will move to REJECTED status. Since the first bet is cashed out with the full amount, and a new bet could not be created successfully, it will be as if the first bet received a regular cashout with full amount.
Partial Placement Rollback
POST
{clientApi}/ticket/rollback-partial-placement
A server error may occur on both side during "partial cashout` request.
In this case, CmsWager system can't know if the bet was cashed out. To prevent discrepancies, if the partial-cashout request does not get a meaningful response (Like a success response, or a client error indicating the bet cant be cashed out for whatever reason) The CmsWager system will send a "rollback" request to revert the actions taken.
The amount must be added to user balance only if the new bet was successfully created on the client system.
If the new status (in request) is the same of the client system, no action need to be taken in client system and a 200 response must be returned.
Example Request
Example Success Response
Response code
200
If the bet is not created in the first place, this means all is good, and there is no need for a rollback. A success response can be returned.
If the bet is created, the bet should be removed, and the balance that was withdrawn from the user should be refunded.
Example Failure Response
Response code
406
If there is any error in client system, a 406 response cose should be returned
Last updated