How to integrate your business with the ESCS

Why should you?

  • Integration with ESCS allows you to offer to your customers p2p wagering and competitions on any game connected to the ESCS.

  • ESCS automates the whole process and connects to your payment processing.

  • ESCS takes a small transaction fee for the service and gives 50% to the publisher.

Step 1 - Registration

  1. Register in the client.escs.io and create a game - as if you are a game publisher. Take a look here https://docs.escs.io/integration-step-1. Skip the part with scores and game modes.

  2. Generate a secret key and save it like shown below. Remember your public key and secret key. You will need them later.

  3. Add a payment method to your account. Take a look below.

    Click on "Payment options"
    Click on "Pay In"
    Enter a credit card - check “Save payment method”.

Step 2 - oAuth preparations

  1. Login with your credentials from the client.escs.io to the account.escs.io and create and oAuth app, choosing ESCS as an oAuth provider like shown below.

    Click on “Account”
    Click on “Manage Apps”
    Click on “+Create”
    Choose a name for your app, enter some description, choose “ESCS OAuth Provider”, enter the url of your service in “Allowed hosts” and press “+”, click “Save”
    Copy your secret key and the app id.

Step 3 - API integration flow

The API endpoints

  1. For the integration you will need following API endpoints from the ESCS:

    1. Gives you a list of all the games available in the ESCS for you: https://api.escs.io/rpc/GetGames

    2. Gives you a list of available scores for the selected game: https://api.escs.io/rpc/GetGameScoreTypes

    3. Gives you a list of all available game modes for the selected game: https://api.escs.io/rpc/GetGameModes

    4. This is the endpoint to set the metadata: https://api.escs.io/rpc/SetPlayerGameMetadata

    5. This is the endpoint to create the wager: https://api.escs.io/rpc/CreateWagerTournament

    6. This is where you submit the wager data after the wager was completed: https://api.escs.io/rpc/CreateWagerTournamentBet

    7. This is the endpoint, where you get the players scores after they completed the game: https://api.escs.io/rpc/SubscribeToEvent

    You can find examples in our Postman: https://escs-postman.postman.co/workspace/Team-Workspace~9d567d98-0b92-43ca-8e23-5b0695b63bb3/collection/22121254-04dd1595-2295-4fa1-93c1-557f070a938e?action=share&creator=32809010

Getting games

Let your users select a game, game mode and score type. In general it is up to you how you present this part to your users – via the corresponding API endpoints ESCS provides you the catalog of games, game modes and scores. You can design the front-end part completely on your own or use some of the ESCS templates.

Getting a list of games. To get the list of the available games call this endpoint. https://api.escs.io/rpc/GetGames Use the following parameters.

As a response you are getting a list of games.

The relevant parameters for you are _id, name, description and the logo. Use this data to display the list of games to your users. To display the logo take the file name from the response and attach it to https://storage.escs.io/file/ . Example: https://storage.escs.io/file/10b57d14-458a-4e60-9449-9b0d7e0827d0.

Getting game scores

After user chooses a game you can get a list of available scores for this game via a following endpoint: https://api.escs.io/rpc/GetGameScoreTypes For the request you really need only the gameId of the game selected by the user.

As a response you are getting a list for the scores that are available in this game.

To present scores to your users you just need the name and the description. When the score is selected you need the score id ("_id") to send to the ESCS later. The scores are set up by the game developer and this makes them self explanatory to users. Let your users choose one of the available scores.

Getting game modes

The list of the available game modes for this game you are getting via a following endpoint: https://api.escs.io/rpc/GetGameModes

To get the list of the game modes you just need a gameId of the game that the user selected.

In the response you are getting a list of the game modes that the game developer set up for this game.

Read more on the game modes here https://docs.escs.io/tournament-series/game-mode-and-scores. The game modes are set up by the game publishers and should be recognizable by the players. You can display just the name and the description of the game mode, or also additional parameters, like the minimal number of the participants in the game. Let the user select one of the game modes.

The important parameter for you is: maxParticipantsInSet - the maximum possible number of players in one game. The maxParticipantsInSet is the maximum number of the participants in the wager.

oAuth integration

After the user selected the game, game modes and scores for the wager and entered additional parameters that are required by your system, the user presses something like a button “Create wager”. After that you need to guide the user through the following steps.

Connect user’s account in your system to the ESCS account system - the following description resembles classic oAuth flow.

Present to a user a call to action “Please connect your [YOUR SERVICE NAME] account the ESCS account to proceed. Login or register to the ESCS on the next screen.” Redirect user as following

Player logs in or creates an escs account.

account.escs.io redirects the user back to the YOUR_REDIRECT_URL that was sent by you with a one time code that you will use to get the user’s information from the ESCS backend.

Pass the one time code from the previous step to your backend and then get user’s ESCS id from the ESCS backend via the following 2 steps. While the user is waiting you should show a screen with a loader and something like “Please wait…”

Take the auth token and send the request to receive the user ESCS id.

After you received user’s id (”userId” in the above) you need to save it in your system. You will match the scores based on this id later.

After the account is connected process the payment for the user. You can process the payment also before connecting the accounts - it is up to you.

Create a wager and set the metadata

Now create the wager and set the metadata in the ESCS system - we strongly recommend to do it only after the payment for the user has been successfully processed.

First, create the wager. Use this endpoint. https://api.escs.io/rpc/CreateWagerTournament

As a parameter in the "options" above, use this JSON template. It is a template for the simple one match wager (kind of a bracket). Leave everything as it is and set only the following values (see also comments in the code).

Simple N vs N Wager Template

After you created the wager, you are getting the following response with a tournament id and a deep link.

You need to save both. The deep link will get users directly in to the game lobby to play their match. Before showing the deep link to any user, add ESCS user id to the link in the following manner. deepLink + %26userAccountId%3D{escsUserAccountId} Here is an example how it should look like: https://someurl/?escsplayer=custom-championships%2F%3FinviteCode%3D4IAIH0NF%26userAccountId%3D{escsUserAccountId} This will allow ESCS to offer a better user experience to the user.

After you succesfully created the wager, you need to set the metadata for the user - so that the user is able to participate in the wager.

https://api.escs.io/rpc/SetPlayerGameMetadata

You get the response with data - means everything is fine. You do not need any of the data from the response.

Getting wager results

Now subscribe to the event to receive user’s scores after they finished to play the wager. https://api.escs.io/rpc/SubscribeToEvent

When the wager is finished you’ll get the following response - this is not the response to the request above, this is the data you receive after the tournament end, which is what you need.

You need the EventData. Based on the escsUserId and isWinner you can match the user to the user in your system and distribute the winnings.

After the wager is created you should show to the user, that created the wager a link to invite other players to play. This link should lead to your service/website.

Joining new users to the wager

You need to guide any new user that joins the wager through the steps of connecting their account and you need to set the user’s metadata as described above.

Only after any new user paid for the wager and connected their account in your system to the ESCS account, show to the user the deep link to the wager as described above.

Sending the wager data to the escs

After the wager was successfully completed you need to call the following endpoint https://api.escs.io/rpc/CreateWagerTournamentBet

tournamentId is the id that you got when you created the wager. betAmount is the total amount of the wager (the sum of all user payments for this wager) in US dollar cents.

Now you are done. :-)

Last updated

Was this helpful?