How-tos

Learn about additional features from our how-tos.
Expand all
Collapse all

How to try account linking in demo

You can implement the following features by linking a player's account on different platforms to the main account:

  • automatic player identification on different platforms
  • manage a single cross-platform inventory on different platforms

Use demo scenes to check the linking of platform accounts to the main account for a preset Publisher Account project.

Note
You can link only one account of each platform to the main account.

To try account linking in a demo project:

  1. Go to your Unity project.
  2. Set up the demo scene to log in to the application via the platform account:
    1. In the main menu, go to Window > Xsolla > Edit Settings.
    2. Set the following parameters in the Inspector window:
      1. Specify Publishing platform. The selected value must be different from Xsolla and None.
      2. Change Username from console.

  1. Start the Xsollus demo scene from the Assets > Xsolla > DemoCommon > Scene folder.

  1. Click User account and then Account linking in the demo scene. The demo project will open in the default browser to simulate the start of the application on another platform.

  1. Click Create an account.

  1. Specify email and password. Click Accept and create.

  1. Select an item in the catalog and click Buy on Xsolla. Purchase the item using one of the test bank cards. Close the receipt.

  1. Click on the email at the top of the screen to open the menu. Click Inventory. Make sure that the purchased item is available in the inventory.

  1. Click Get code. Click Request the code in the opened window. Write down the received account linking code.

  1. Go to the demo scene in Unity.
  2. Enter the received account linking code (see step 9) and click Confirm.

  1. Now the platform account is linked to the main account. Make sure that the purchased item is available in the inventory in the Unity demo scene.

  1. Since this account is already linked to the main account, you can get the account linking code from it. Click Get account link. Write down the received code.

  1. Set up the demo scene to log in to the application via another platform account (see step 2). The Publishing platform should be different from the one selected in step 2.
  2. Start the Xsollus demo scene from the Assets > Xsolla > DemoCommon > Scene folder.

  1. Make sure the player’s inventory is empty.
  2. Click Account linking. Stay in the Unity demo scene.

  1. Enter the received account linking code (see step 13) and click Confirm.

  1. Now the account from the new platform is also linked to the main account. Make sure that the purchased item is available in the inventory of the Unity demo scene.

Follow the recipe to configure account linking for your project.

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.
Hide

How to set up OAuth 2.0 authentication

OAuth 2.0 uses short-lived tokens with long-term authorization (refresh tokens) instead of long-lived tokens. A refresh token allows users to stay in your application for an extended period of time without needing to re-enter their username and password. This eliminates the risk of compromising user authentication data.

Set up OAuth 2.0 for authorization:

  • via username or email and password
  • via social networks
  • via Steam

If the option is enabled, user registration and authentication is carried out by calling the Register a new user and JWT auth by username and password API methods. The Login Unity SDK provides the same methods for OAuth 2.0 authorization as for JWT token authorization. When the engine first initializes an object on the scene, the Awake method is called. The method checks the expiration of the current refresh token.

Note
Enabling this setting doesn’t change the authentication process in your application for the user.

To configure OAuth 2.0 authorization:

  1. Set up OAuth 2.0 authentication for Login project in your Publisher Account.
  2. Set up asset in your Unity project.

Set up OAuth 2.0 authentication for Login project in your Publisher Account

  1. Go to your Publisher Account.
  2. Click Open in the Login block and go to Login projects.
  3. Click Open and set up in the Login project block.
  4. Go to General settings > Authorization.
  5. Click Connect in the OAuth 2.0 authentication block.
  6. Specify OAuth 2.0 redirect URIs and click Connect.
  7. Copy and save the Client ID.

Set up asset in your Unity project

  1. Go to your Unity project.
  2. Click Window > Xsolla > Edit Settings in the main menu.
  3. In Inspector window:
    1. In the Authorization method field, select OAuth2.0.
    2. In the OAuth2.0 client ID field, specify Client ID received when setting up OAuth 2.0 in Publisher Account.

The following methods are implemented in Login Unity SDK to work with refresh tokens:

  • IsOAuthTokenRefreshInProgress — returns true during refresh token process, false otherwise.
  • ExchangeCodeToToken — exchanges the user's authentication code for a valid JWT.

The oauthState argument found in the GetSocialNetworkAuthUrl method is used for additional user verification during OAuth 2.0 authentication. This argument is used to mitigate possible CSRF attacks.

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.
Hide

How to integrate SDKs in projects for Android applications

Recommendations

When developing projects for Android applications, follow these recommendations:

  1. Set up native authentication via social networks.

Note
Currently, native authentication is supported by the following social networks:
  • Google
  • Facebook
Use the WebView tool to set up native authentication for other social networks.

  1. Set up deep links to return users to the application after they confirm registration via email.
  2. Customize registration confirmation email.

Note
You can disable sending of registration confirmation emails if your security principles allow it. Contact your Account Manager to disable it, or email am@xsolla.com.

  1. Choose and set up the most suitable method of working with an in-game store. If you wish, you don’t have to implement the cart feature in your game. Instead, implement the ability to make an in-game purchase by clicking the Buy button.
  2. Set up user redirection to your application after making a payment via an external browser.
  3. Follow the Unity customization instruction to customize the UI for errors and pop-ups. Errors and pop-ups in the integration demo are created for game developers. Therefore, make them more suitable for the end users of your application.

  1. Go to Publisher Account.
  2. To set up returning users to the application after they confirm registration:
    1. Go to your project and click Open in the Login block.
    2. Go to Login projects.
    3. Click Open and set up.
    4. Go to the URL block, specify Callback URL, and click Save changes.

  1. To set up user redirection to your application after making a payment via an external browser:
    1. Go to your project and click Open in the Pay Station block.
    2. Go to Settings.
    3. Specify the required parameters in the Redirect policy section and click Save.

  1. Manually create the AndroidManifest.xml file with the code below. Specify:
    • Callback URL divided into 3 parts. The example for https://example.com/callback is below.
    • Return URL divided into 3 parts. The example for https://example.com/return is below.

Copy
Full screen
Small screen
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <application>
        <activity
            android:name="com.unity3d.player.UnityPlayerActivity"
            android:label="@string/app_name"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <data android:scheme="https" />
                <data android:host="example.com" />
                <data android:pathPrefix="/callback" />

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
            <intent-filter>
                <data android:scheme="https" />
                <data android:host="example.com" />
                <data android:pathPrefix="/return" />

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Note
If you want to set up user redirection to your application for only one case, delete the intent-filter block with the corresponding parameters from the code.

  1. Place the created file in the Assets/Plugins/Android folder of your Unity project.

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.
Hide

How to set up native authentication via social networks

Native authentication allows players to log in to your application via installed applications that use social network accounts. Currently, SDK has implemented native authentication via the following social networks:

  • Google
  • Facebook

Note
Native authentication via social networks is available in:
  • Store SDK version 0.5.2.0 and higher for Unity
  • Login SDK version 1.0.0.0 and higher for Unity
  • Inventory SDK version 1.0.0.0 and higher for Unity

To configure native authentication:

  1. Create your Unity project build for Android.
  2. For native authentication via Facebook, create your Facebook developer account and a new application.
  3. Set up the application page in your Facebook developer account.
  4. For native authentication via Google, set up the project in Google API Console.
  5. Set up social networks for the Login project in your Publisher Account.
  6. Set up the asset for your Unity project.

Create Unity project build for Android

  1. Go to your Unity project.
  2. Click File > Build settings in the main menu.
  3. Click Android in the Platform block.
  4. Click Build.
  5. Make sure the hash key is formed:
    1. Click Window > Xsolla > Edit Settings in the main menu.
    2. Make sure that the hash key appears in the Android debug hash key field.

For further native authentication configuration you will need:

  • Package Name found in the Inspector window after selecting the Android platform in File > Build settings.
  • Android class name found in Window > Xsolla > Edit Settings > Inspector > Android class name.
  • Android debug hash key found in Window > Xsolla > Edit Settings > Inspector > Android debug hash key.

Set up application page in your Facebook developer account

  1. Go to project settings in the Facebook developer account.
  2. Go to Settings > Basic.
  3. Click Add Platform and select Android.
  4. Specify Package Name from your Unity project in the Google Play Package Name field.
  5. Specify Android class name from your Unity project in the Class Name field.
  6. Specify Android debug hash key from your Unity project in the Key Hashes filed.
  7. Click Save Changes.

For further native authentication configuration, you will need App ID and App Secret found in project settings in Settings > Basic section.

Set up project in Google API Console

  1. Go to Google API Console.
  2. Click New Project.
  3. Specify Project name and Location and click Save.
  4. Go to the created project and click OAuth consent screen in the side menu.
  5. Select External option and click Create.
  6. Specify the necessary parameters and click Save.
  7. Click Credentials in the side menu.
  8. Create an OAuth 2.0 client for your Unity application:

    1. Click Create credentials and select OAuth client ID.
    2. Specify Android in the Application type field.
    3. Specify Name.
    4. Specify Package Name from your Unity project in the Package name field.
    5. Specify Android debug hash key from your Unity project in the SHA-1 certificate fingerprint field.
    6. Click Create.
    7. Click OK.

  1. Create an OAuth 2.0 client for the web application:
    1. Click Create credentials and select OAuth client ID.
    2. Specify Web application in the Application type field.
    3. Specify Name.
    4. Click Add URI in the Authorized redirect URIs section and specify https://login.xsolla.com/api/social/oauth2/callback URI.
    5. Click Create.
    6. Click OK.

For further native authentication configuration, you will need Client ID and Client Secret found in settings of the Client ID for the web application.

Set up social networks for Login project in your Xsolla Publisher Account

  1. Go to your Publisher Account.
  2. Click Open in the Login block and go to Login projects.
  3. Click Open and set up in the Login project block.
  4. Go to Social connections.
  5. To set up authentication via Facebook:

    1. Click Edit in the Facebook block and change status to Disconnected.
    2. Specify the App ID from the Facebook developer account in the Application ID field.
    3. Specify App Secret from the Facebook developer account in the Application Secret field.
    4. Click Connect.

  1. To set up authentication via Google:
    1. Click Edit in the Google block and change status to Disconnected.
    2. Specify the Client ID for a web application from the Google API Console in the Application ID field.
    3. Specify the Client Secret for a web application from the Google API Console in the Application Secret field.
    4. Click Connect.

Set up asset for your Unity project

  1. Go to your Unity project.
  2. Click Window > Xsolla > Edit Settings in the main menu.
  3. Specify App ID from the Facebook developer account in the Facebook App ID field.
  4. Specify the Client ID for a web application from the Google API Console in the Google server ID field.

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.
Hide

How to set up native authentication via Steam

Native authentication allows players to enter your application via the installed Steam application.

To set up native authentication:

  1. Configure your Unity project.
  2. Configure processing of events.
  3. Ensure authentication via Steam.

Configure your Unity project

  1. Manually create a steam_appid.txt file and type your application ID in Steam there. Then, place this file to the Assets catalog of your project.

Note
If you downloaded an asset from GitHub, you will find the steam_appid.txt file in the Assets catalog. This file includes the application ID in Steam for a demo project.

  1. Open your Unity project.
  2. In the main menu, go to Window > Xsolla > Edit Settings.
  3. In the Inspector window:
    1. Check the Use Steam authorization box.
    2. In the Steam App ID field, specify your application ID in Steam. The value should be the same as the value in the steam_appid.txt file.

Configure the processing of events

To authenticate users via Steam, you should get a session ticket via the SteamAuth method. Pass the received value when calling the RequestTokenBy method. As a result, you get the token that is used when calling the API methods.

Ensure authentication via Steam

  1. Create the build of your Unity project for a stand-alone platform.
  2. Launch Steam and log in.
  3. Launch your application. If everything is correct, the Steam pop-up window appears.

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.
Hide

How to set up authorization in the application via Launcher

You can use Xsolla Launcher to deliver your application to users and update it. The Launcher contains a built-in authorization tool. To avoid the need to re-enter username and password, set up authorization in your application via the Launcher.

Notice
To use the Launcher, you need to configure Login. Using a different authorization system is not supported.

Set up SDK and Launcher to work together

  1. Set up Launcher in your Publisher Account.

Note
In the config.json file, it is enough to change the values ​​for the following objects:
  • launcher_project_id — specify Launcher ID found in Publisher Account > Launcher > General settings > General info
  • login_project_id — specify Login ID found in Publisher Account > Launcher > General settings > Authentication

  1. Customize the launcher UI.

Notice
SDKs integration with Xsolla servers uses Commerce API methods, so the Launcher store is not supported.

  1. Implement the Launcher authorization logic in your application.
  2. Generate a launcher installation file and a build archive.
  3. Create an application build.
  4. Upload the application build to the Xsolla update server.

Implement the logic of authorization via Launcher

When the application starts, the Launcher passes the parameter list via the command line. The authorization token is passed in the xsolla-login-token parameter. Validate the received token. If the token validated successfully, authorize the user in the application.

See an example of the described logic implementation in the demo project.

Create an application build

  1. Go to your Unity project.
  2. Click Window > Xsolla > Edit Settings in the main menu. In the Inspector window:
    1. In the Project ID field, specify the project ID found in Publisher Account > Project settings > Project ID.
    2. In the Login ID field, specify the Login ID found in Publisher Account > Launcher > General settings > Authentication.

  1. Run the user authorization scene, where the token is processed.
  2. Click File > Build settings in the main menu and then click Add Open Scenes. Make sure the authorization scene is added first in the list.
  3. Click Build.
  4. In the pop-up window, specify the path to the directory where the finished build will be placed.

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.
Hide

How to set up token invalidation

Token invalidation allows for improved security of user authentication data in your application. If the option is enabled, a new token replaces the old one that becomes invalid every time the user authenticates.

Note
You can configure token invalidation for authentication that uses a JWT token. For OAuth 2.0 authentication, token invalidation is provided by the protocol itself and does not need to be configured separately.

When using the Login Unity SDK, invalidation of the existing token and generation of a new one is made by calling Auth by username and password and Auth via social network API methods, if the with_logout parameter has the 1 value.

To enable token invalidation in your Unity project:

  1. In the main menu, go to Window > Xsolla > Edit Settings.
  2. In the Inspector window, check the Enable JWT invalidation box.

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.
Hide

How to work with user attributes

You can use attributes to manage additional information about the users of your application. The user attribute is a key-value pair. The Login SDK supports the following types of attributes:

  • User-editable attributes. The values for this type of attributes are entered by a user or specified according to the in-game logics on the client side. For example: the name and character stats, game difficulty level, etc.

  • Read-only attributes. The values for this type of attributes are entered and edited on the server side of your application. We recommend you use them for configuration of game character stats or user parameters that shouldn’t be changed a lot. For example: use them for the chance to get a bonus, game character key parameters, user categories, etc.

To manage user attributes, use the following SDK methods:

When working with read-only attributes, you can use a server token or a Publisher Account token for authorization.

To get the Publisher Account token:

  1. Enter your Publisher Account.
  2. Go to the cookie files viewpage via the developers’ tools in your browser.
  3. Copy the value from the pa-v4-token parameter and paste it to the Authorization header.

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.
Hide

How to work with user account in your application

Users can configure the following data from a user account:

  • public profile data:
    • avatar
    • nickname

  • personal user data:
    • name and surname
    • birthdate
    • gender
    • phone number
    • email

Note
To set some additional user parameters or set the parameters of a game character, use the instruction on how to work with user attributes. You can add the friend list management functionality in the user account if the friend system is implemented in the application.

You can manage the user account via the API methods. The Login Unity SDK has the following methods implemented:

  • GetUserInfo — updates locally cached user data.

Note
The user can set their birthdate only once. The entered value can’t be changed in the future.

  • UpdateUserInfo — changes the specified user’s data.
  • GetUserPhoneNumber — updates the locally cached user phone number.
  • ChangeUserPhoneNumber — changes the user’s phone number.
  • DeleteUserPhoneNumber — deletes the user’s phone number.
  • UploadUserPicture — changes the user’s avatar.
  • DeleteProfilePicture — deletes the user’s avatar.

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.
Hide

How to work with friend system in your application

The friend system allows your users to find each other and set up social connections. The SDK supports the following functionality:

  • search by nickname
  • get the list of friends from social networks
  • manage the friend list, send invitations, add and remove friends, block users, etc.
  • manage personal data via the user account

To implement the friend system, you should have the user account functionality in your application. Methods of working with this system use the following parameters from the user account:

  • user ID
  • avatar
  • nickname

Users should specify the nickname to ensure the friend system works correctly. Implement the following nickname specification logics:

  • Use the name that was used for registration via login and password as a nickname.
  • Implement the nickname request during social authentication or platform accounts.

SDK methods

The Login Unity SDK has the following methods of working with the friend system:

  • GetUserFriends — updates the locally cached user friends data. The Get friends API method is used alongside the SDK method.

  • UpdateUserFriends — updates the status of the user’s social connections. The Update friends API method is used alongside the SDK method. The social connections status is affected by the following actions:
    • send or cancel a friend request
    • accept or decline a friend request
    • delete the user from the friend list
    • block or unblock the user

  • GetUserSocialFriends — updates the locally cached data of user’s friends from a social network. The Get user’s friends API method is used alongside the SDK method.

  • GetPublicInfo — gets data from the user’s public profile. The Get user public profile API method is used alongside the SDK method.

  • SearchUsers — searches for the user by nickname. The Search users by nickname API method is used alongside the SDK method.

  • LinkSocialProvider — links the user account and a social network that the player uses for authentication. The Link social network to user's account API method is used alongside the SDK method.

  • GetLinkedSocialProviders — updates the user’s social networks data. The Get linked networks API method is used alongside the SDK method.

Implementing a friends system for social networks

To let users interact with friends from social networks in your application, configure the storage of friend data on the Xsolla side:

  1. Go to your Publisher Account.
  2. Click Open in the Login block and go to Login projects.
  3. Click Open and set up in the Login project block.
  4. Go to General settings > Authentication.
  5. Set the Store friends from social networks toggle to On.
  6. Save changes.

To make friends from the social network available to the player in the application, implement the following logic in your application:

  1. Link a social network to a player's account using the GetSocialNetworkAuthUrl method. The Get URL to link social network to account API method is used alongside the SDK method.
  2. Update your friends list using the UpdateUserSocialFriends method. The Update user’s friend API method is used alongside the SDK method.
  3. Get a list of friends from a linked social network using the GetUserSocialFriends method. The Get user’s friends API method is used alongside the SDK method.

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.
Hide

How to work with coupons

To get new users to your application and increase sales, you can implement coupon promotions. When redeeming a coupon, the user may receive one of the following rewards:

  • virtual currency package
  • game key
  • virtual item

For details on the features and limitations of coupon promotions, see the In-Game Store guide.

To work with coupon promotions:

  1. Complete the settings in Publisher Account following to the instructions for setting up promotional campaigns with coupons.
  2. Implement in-game logic using the following SDK methods:

    • GetCouponRewards — gets a list of items that can be credited to the user when the coupon is redeemed. The Get coupon rewards API method is used alongside the SDK method.
    • RedeemCouponCode — redeems the coupon code and rewards the user. The Redeem coupon code API method is used alongside the SDK method.

Note
If it is undesirable for your application to implement an interface and additional logic for working with coupons, contact your Account Manager to set up a campaign with coupons. In this case, the input and activation of the coupon are carried out not in the interface of the cart, but when paying for the purchase in Pay Station.
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.
Hide

How to work with promo codes

To get new users to your application and increase sales, you can implement a campaign with promo codes. When redeeming a promo code, the user may receive one or more of the following rewards:

  • discount that applies to the user’s cart
  • bonus items:
    • virtual currency package
    • game key
    • virtual item including a bundle or nonrenewing subscription

For details on the features and limitations of campaigns with promo codes, see the In-Game Store guide.

To work with promo codes:

  1. Complete the settings in Publisher Account by following the instructions for setting up a campaign with promo codes.
  2. Implement in-game logic using the following SDK methods:

    • GetPromocodeReward — gets promo code rewards. Allows users to choose one of many items as a bonus. The Get promo code reward API endpoint is used alongside the SDK method.
    • RedeemPromocode — redeems promo code. After redeeming a promo code, the user gets free items and/or the price of the cart is decreased. The Redeem promo code API endpoint is used alongside the SDK method.

Note
If it is undesirable for your application to implement an interface and additional logic for working with promo codes, contact your Account Manager to set up a campaign with promo codes. In this case, the input and activation of the promotional code will be carried out not in the interface of the cart, but when paying for the purchase in Pay Station.
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.
Hide

How to work with bundles

To get new users to your application and increase sales, you can sell sets of items as bundles for less than the cost of their content.

A bundle may include:

  • virtual currency (including the platform-dependent currency)
  • package of virtual currency
  • game keys for preselected DRMs
  • virtual items including nonrenewing subscriptions
  • bundles

For details on the features and limitations of bundles, see the In-Game Store guide.

To work with bundles:

  1. Complete the settings in Publisher Account by following the instructions for setting up a bundle.
  2. Implement in-game logic using the following SDK methods:

    • GetBundles — gets a list of bundles for building a catalog. The Get list of bundles API endpoint is used alongside the SDK method.
    • GetBundle — gets a bundle for the specified SKU. The Get specified bundle API endpoint is used alongside the SDK method.

Note
For bundles that contain items sold for real currency, the total cost of these items is passed in the total_content_price parameter. You can use this value to display the benefits of buying a bundle in your application.
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.
Hide

How to create an application build to run in a browser

Create a WebGL build to run your application in a browser.

Select the Unity WebGL component when installing Unity Editor. To add a module to an already installed Unity Editor, run the installer for your version and select the missing components.

Demo WebGL build
See the demo in a browser.

To create a WebGL build:

  1. Open your Unity project.
  2. Go to File > Build settings.
  3. In the Platform panel, select WebGL.
  4. Select build type (optional).
  5. Click Build and Run.

Note
Not all Unity features are available in WebGL builds. See the Unity documentation for limitations.

For the payment interface to work correctly, open it in an iframe. To do this, call the Purchase method of the Assets > Xsolla > Plugins > paystation JS library following the Unity instructions.

Continue reading

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.
Hide

How to use your own login system

You can integrate Store Unity SDK, Payments Unity SDK and Inventory Unity SDK with your own login system. To do this, you need to implement user authentication in your application via Pay Station access token. See the authentication algorithm in the In-Game Store documentation.

To use your own login system:

  1. Configure the asset for your Unity project.
  2. Implement the logic of processing the Pay Station access token.

Configure the asset for your Unity project

  1. Go to your Unity project.
  2. Click Window > Xsolla > Edit Settings in the main menu. In the Inspector window, select the Access Token value in the Authorization method field.
  3. In the Authorization server URL field, specify the address of the authorization server.

Logic of processing the Pay Station access token

  1. For authorization, use the GetUserAccessToken method that returns the Pay Station access token received from the server side of the application.
  2. Use the obtained token in the Store Unity SDK or Inventory Unity SDK methods instead of the JWT token.
  3. Implement the logic of receiving a new Pay Station access token after its expiration. It is recommended that you get a new token in the background mode, so the user doesn’t have to log in to the application again.

Note
The lifetime of the Pay Station access token when working with the in-game store and inventory is 1 hour after the last call to the Xsolla API. To change the lifetime of the Pay Station access token, contact your Account Manager.
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.
Hide

How to use the in-game store site with the SDKs

Implement the sale of virtual items and virtual currency outside the game via the in-game store site. The purchased items and currency will be available in the player's inventory.

Note
You can integrate the in-game store site with the Inventory Unity SDK or Store Unity SDK.

To integrate your store site with the SDK:

  1. Create a store site.
  2. Specify the site address of the in-game store in the application code.
  3. Implement the logic for your application to work with the store site.

Create a store site

You can create a store site with Site Builder by following the instructions for connecting a store on the site.

Notice
By default, when creating a site, a new Login project is created in Publisher Account. When setting up Site Builder, use the same Login project as when you set up the SDK.

If you want to connect a store site that was created using a different solution, follow the instructions for creating a store.

Recommendations for the logic for your application to work with the store site

Follow these recommendations when developing your application:

  1. Synchronize the fields of user registration and authorization in your application and in the Login widget on the store site:
    • If a user email and password are used for registration and authorization, set the username equal to the email in the application.

Note
The widget uses the user's email and password by default for authorization and registration.

    • If you use a username, user email and password for registration and authorization, contact your Account Manager to change the Login widget fields.

  1. When navigating to the store site from the application client, implement pass-through user authorization. To do this, the user token must be passed in the URL parameters. An example of authorization is shown in the demo scene for the Inventory Unity SDK.

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.
Hide