Seamless Integration

  1. Game Workflow Overview The User launches a game on the Client System.

The Client System generates a new session token that will be used to identify the User’s session for subsequent communication between the Client System and the Playbetr System.

The Client System sends a HTTP POST request to the Playbetr System with the following fields:

session_token The session token generated by the Client System that is used to identify the User’s session for all further communication. The session token should be a unique, alphanumeric string that is 64 characters in length or less. A new session token should be generated for each User session. user_id A unique id for the User. The user_id value should be an unsigned integer. user_name *optional An optional user name can be sent with the request. user_url *optional An optional URL for the User’s account page on the Client System. balance The User’s current account balance. game The Playbetr game the user is attempting to play.

Upon successful initialization, the Playbetr System will return a JSON object containing a return code and a URL for launching the game. This URL can be opened up in an iframe or the User can be redirected to the URL.

Example return object:

{ "code": 200, "url": "https://api.playbetr.com/game/alk1lj2kj1lakjaa01298881lkaah212k1k1k1" }

When the User places a bet, the Playbetr System will send an HTTP POST request to the Client System indicating that a bet has been placed. The Client System should deduct the funds from the User’s account and return the new balance for the user.

When the results of a bet are determined, the Playbetr System will send an HTTP POST request to the Client System with the results of the round. The Client System should credit any winnings to the User’s account and return the new balance for the user.

4. Client System Endpoints 4.1 Bet The Bet endpoint is hit any time the User places a bet on the Playbetr System. This request will come as an HTTP POST and will contain the following fields:

session_token This is the original session token generated by the Client System and should be used to authenticate this request. user_id The unique id for the User. round_id The id for the current round. bet The amount of the bet placed by the User.

The Playbetr System expects a Json encoded object to be returned by the Client System containing the following values:

code The return code for this request. See section 2.3 for return codes. balance The new balance for the User.

Example return object:

{ "code": 200, "balance": 10.203 }

4.2 Results The Results endpoint is hit after a round is finished and contains the amount won by the User. This request will come as an HTTP POST and will contain the following fields:

session_token This is the original session token generated by the Client System and should be used to authenticate this request. user_id The unique id for the User. round_id The id for the current round. won The amount won by the User. A value of 0 (zero) would indicate that the User did not win the round. round_details A Json encoded object containing additional round details as provided by the game being played.

The Playbetr System expects a Json encoded object to be returned by the Client System containing the following values:

code The return code for this request. See section 2.3 for return codes. balance The new balance for the User.

Example return object:

{ "code": 200, "balance": 10.203 }

4.3 Balance The Balance endpoint is hit whenever the Playbetr System needs an updated balance for a user. This request will come as an HTTP POST and will contain the following fields:

session_token This is the original session token generated by the Client System and should be used to authenticate this request. user_id The unique id for the User.

The Playbetr System expects a Json encoded object to be returned by the Client System containing the following values:

code The return code for this request. See section 2.3 for return codes. balance The new balance for the User.

Example return object:

{ "code": 200, "balance": 10.203 }

4.4 Refund The Refund endpoint is hit whenever the Playbetr System needs refund a bet for a user. The only time the Playbetr System will issue a refund is when an error occurred between a User placing a bet and winning a round. This request will come as an HTTP POST and will contain the following fields:

session_token This is the original session token generated by the Client System and should be used to authenticate this request. user_id The unique id for the User. round_id The id for the round for which the refund belongs. refund The amount to be refunded to the User. refund_reason The reason a refund is being issued.

The Playbetr System expects a Json encoded object to be returned by the Client System containing the following values:

code The return code for this request. See section 2.3 for return codes. balance The new balance for the User.

Example return object:

{ "code": 200, "balance": 10.203 }