How to transfer user data via launcher installer

How it works

You can transfer user data from the website to the game through the launcher installer, for example:

  • Information for tracking promotions or the source of the launcher installer download.
  • Data with a limited lifespan. Used for custom authentication in the game and transfer of critical game-related information.
To transfer data to the launcher, extended functionality of a one-time password is used (the basic scenario is described in the instruction).

Who can use it

Partners who have already integrated Launcher and Login and connected OAuth 2.0 authentication.

How to get it

To enable transfering of user data, implement the following:

  1. Retrieval of a one-time password.
  2. Adding the one-time password to the installer’s name.
  3. Processing of user data transmitted to the game (optional).

Retrieval of a one-time password

To implement obtaining a one-time password, make a POST request to the URL address https://launcher.xsolla.com/otp. In the request body, pass a JSON with the following parameters:
  • tracking_payload — user data with an unlimited lifespan. The maximum string length is 255 characters.
  • common_payload — User data with a limited lifespan. These data can be overwritten. The maximum string length is 255 characters.
  • expires_in — the lifespan of the data passed in the common_payload parameter in the Unix time format, in milliseconds. Required if common_payload is being transmitted.
Example request for obtaining a one-time password:
Copy
Full screen
Small screen
    curl
    -X POST
    "https://launcher.xsolla.com/otp?common_payload=<common_payload>"
    -H
    "accept: application/json"
    -H
    "Content-Type: application/json"
    
    Note
    If the tracking_payload, common_payload or expires_in parameters are used, their values cannot be empty.
    You can also pass the tracking_payload as a query parameter.
    Copy
    Full screen
    Small screen
      curl -X POST "https://launcher.xsolla.com/otp?tracking_payload=<tracking_payload>" -H "accept: application/json" -H "Content-Type: application/json"
      

      Adding the one-time password to the installer’s name

      The received one-time password is a 36-character string in UUID format. Implement adding the one-time password to the installation file name when downloading in the following format: LauncherName_<OTP>.exe, where <OTP> is the one-time password.

      Retrieval of user data by the game

      The launcher passes the data received in the tracking_payload parameter as the –tracking_payload command line argument value, as shown in the example below. It also checks for the presence and lifespan of data passed in the common_payload parameter and passes it as the value of the –xsolla-common-payload command-line argument, as shown in the example below.
      Copy
      Full screen
      Small screen
        game.exe --tracking_payload <tracking_payload> WU9VUiBEQVRBIEhFUkU=
        
        Note
        The launcher sends user data to the game every time the game is started.
        When launching a browser game, the launcher passes the data received in the tracking_payload parameter as the value of the tracking_payload query parameter, as shown in the example below.
        Copy
        Full screen
        Small screen
          https://web-game-plum.vercel.app/api?locale=en&tracking_payload=<tracking_payload>
          

          The tracking_payload parameter is passed in UTF-8 encoding. To decode it, implement the execution of the decodeURIComponent(<tracking_payload>) function on the game side.

          Was this article helpful?
          Thank you!
          Is there anything we can improve? Message
          We’re sorry to hear that
          Please explain why this article wasn’t helpful to you. Message
          Thank you for your feedback!
          We’ll review your message and use it to help us improve your experience.
          Last updated: September 24, 2024

          Found a typo or other text error? Select the text and press Ctrl+Enter.

          Report a problem
          We always review our content. Your feedback helps us improve it.
          Provide an email so we can follow up
          Thank you for your feedback!