We have partnered with Xsolla to offer you the possibility to integrate in-game purchases more conveniently.
In-game purchases are an invite only feature. If you are interested in using them, please get in touch with us.
The Xsolla Unity SDK can be found here.
When using the Xsolla SDK, you will need one of the following ways of authentication:
- The token received from the
GetXsollaUserToken()method from the SDK. This method generates a custom Xsolla token that you use with the Xsolla SDK. The purchases are linked to the CrazyGames user account. This is applicable for Scenario 2 and Scenario 3.
- Alternatively, we can invite you to our Xsolla account, so that you generate the necessary Xsolla credentials on your own, and use the SDK with the generated credentials. Purchases will be linked to your in-game user accounts. This is applicable only for Scenario 3. You can also skip the rest of this guide.
In-game purchases should be available only for the users that are signed in. Guest users should not be able to purchase items.
Get Xsolla token
If you would like to use the token provided by us, the only Xsolla SDK setup required is adding the Project ID, which will be provided by us.
You don't need any additional Xsolla setup, or to handle Xsolla login, since Xsolla will automatically handle the user account creation with the user ID included in token, which is the ID of the CrazyGames user. Thus, all the purchases made using the token will be also linked to the CrazyGames user account.
You can retrieve the Xsolla token like this:
We recommend that you retrieve the token every time before using it, since the tokens are usually short-lived, for example only 1 hour. Our SDK handles the token refresh.
After retrieving the token, you can use it like this:
You can now call the methods from the Xsolla SDK, for example
GetXsollaUserToken() method will work only in the QA tool or CrazyGames.com. Please notice that the QA Tool can be accessed either from the sidebar of the developer portal (standalone QA Tool) or when editing your game. The Xsolla token generation will work only in the QA tool that is accessed from the game since it requires your game id.
For the initial testing, we recommend testing with sandbox orders, which allow purchasing items with fake money. When you submit the game, please ensure the sandbox orders are disabled.