Intégration des serveurs Xsolla

With this type of integration, the following tasks are performed on the Xsolla side:

  • catalog storage and management
  • price management
  • storing data on regional prices
  • regional restrictions management
  • inventory management
  • management of promotional campaigns
  • user authentication
  • user access management
  • transaction processing

You don’t need to configure your own server side for these tasks.

Flux d'intégration

To integrate with Xsolla servers using the Game Commerce asset:

  1. Install the asset.
  2. Set up the project in your Publisher Account.
  3. Set up Login or implement your own authorization system using the Pay Station access token.
  4. Set up the Virtual Currency module (optional).
  5. Set up the Virtual Items module.
  6. Set up your Unity project.

After the integration is complete, test the payment process.

Contacter notre équipe d'intégration
Cliquez sur l'icône de chat en bas à droite pour contacter l'équipe d'intégration via la messagerie instantanée de votre choix. Nous vous répondrons en temps réel et vous aiderons à résoudre le problème.
Note
This guide describes the minimum settings required to quick-start the module. For any questions, contact your Account Manager.

Installer un asset

Note
Seule la dernière version du SDK est disponible via le CDN. Si vous avez besoin d’une version différente, vous pouvez la télécharger à partir de GitHub.
  1. Download Unity.
  2. Pick a personal or professional Unity license based on your preferences.
  3. Create a new Unity project.
  4. Download the asset.
  5. Unzip the package.
  6. In the Unity editor, go to Assets > Import Package > Custom Package in the main menu and select the asset.
  7. Make sure that the Mono compiler is used for creating a game build (for standalone builds only). To do this:
    1. Click Edit > Project Settings in the main menu.
    2. Go to the Other Settings > Configuration section.
    3. Make sure that Mono is chosen in the Scripting Backend field.

After installing the asset, launch the Xsollus demo scene from the Assets > Xsolla > DemoCommon > Scene directory. The demo scene shows the features of the asset and represents a possible implementation of the application logic.

For the demo scene, a project in Publisher Account is preset and an in-game store is fully configured.

Default values for the Xsollus demo scene:

KeyValue
Login ID026201e3-7e40-11ea-a85b-42010aa80004
Project ID77640

You can use the demo scene in two ways:

  • as an example
  • as an initial version of the login system, inventory, and in-game store in order to get a quick result and expand its capabilities if necessary

To use the demo scene or its parts in your application, add it in build settings:

  1. Go to Assets > Xsolla > DemoCommon > Scene and launch the Xsollus scene.
  2. Open File > Build settings and click Add Open Scenes.

Créer un projet dans le Compte éditeur

  1. Sign up to Publisher Account.
  2. Configure your project:
    1. To fill in the game data automatically, provide the Link to your game on any platform. As a result, the image of the game, its name, and description will be added to the project settings.
    2. To fill in the game data manually, click I don’t have a link, set up manually and specify:
      • project languages (English is set by default)
      • project name for all specified languages
      • game website (optional)
    3. Click Create project.

During the integration process, you will need the project ID. Can be found in Publisher Account beside the name of your project.

Configurer un projet de connexion de base

  1. Open your project in Publisher Account.
  2. Click Connect in the Login pane or select Login in the side menu.
  3. Click Create Login project.
  1. Select Standard Login project and click Create and set up. Wait until your new Login project is created. Then you will see the project settings navigation page.
  2. In the Login methods block on the navigation page, select the method that suits your game best and click Configure.
  1. The Login product offers three options for your games:
    • Classic login
      Users log into the game by providing their username and password. In addition, users can log in using one of their social networks.
    • Passwordless login
      Users log into the game using one-time codes or links sent to their email address or phone number. Login via social networks is also supported.
    • Social login
      Users enter the game only through social networks.
  1. In the top settings block on the navigation page, click Callback URLs and set the following parameters:
    • Callback URL — the URL or path in the application to which users are redirected after they have successfully authenticated, confirmed their email, or reset their password. You can specify multiple valid URLs.
    • Error callback URL — the URL or path in the application to which users are redirected in case of an authentication error. If no value is specified, the Callback URL value will be used.
  1. Click Save changes.
  1. Set up a social login (optional):
    1. Click the name of your Login project in breadcrumb navigation to return to the navigation page.
    2. Go to the Authentication block and select the Social login section.
    3. Connect social networks that users will be able to use to sign up and log into the application:
      • To connect the desired social network, click the ⚙ icon and select Connect.
      • To connect several social networks at once, select the required panes (their borders will turn green). Then, from the Manage drop-down menu, select Connect.
      • To connect all available social networks at once, click Select all. Then, from the Manage drop-down menu, select Connect.
  1. Set up OAuth 2.0 authentication:
    1. Click the name of your Login project in breadcrumb navigation to return to the navigation page.
    2. Go to the Security block and select the OAuth 2.0 section.
    3. Click Add OAuth 2.0.
    4. Specify OAuth 2.0 redirect URIs and click Connect.
    5. Copy and save the Client ID.
  1. Change the user data storage (optional). By default, user data is stored and processed on the Xsolla’s side. If you want to connect PlayFab, Firebase, or your own custom storage, follow the instructions: Connect user data storage.

During the integration process, you will need the following parameters:

  • Login ID. To get it, open Publisher Account, go to the Login > Dashboard section, and click Copy ID beside the name of the Login project.

  • Client ID. It can be found in Publisher Account in the Login > your Login project > Security > OAuth 2.0 section.

Configurer le module Monnaie virtuelle

  1. Open your project in Publisher Account.
  2. Click Connect in the Store pane. You can go to the In-Game Store settings from any section of Publisher Account by clicking the Store in the side menu.
  1. Click Connect in the Virtual Currency pane.
  1. Create virtual currency:
    1. Click Create virtual currency.
    1. Specify the following information:
      • SKU
      • currency name
      • price of one unit of virtual currency
      • default currency
      • features of hard virtual currency (optional)
      • image (optional)
    2. Click Create currency.
  1. Create packages of virtual currency:
    1. Go to Packages.
    2. Click Create package.
    1. Specify the following information:
      • SKU
      • package name
      • short description
      • virtual currency
      • quantity of currency units in a package
      • price
      • default currency
      • image (optional)
    1. Set the Show in Store toggle to On.
    2. Click Create package.
Note
The asset supports purchasing of virtual items for virtual currency. Also, the users are able to use virtual currency according to in-game logics (getting access to a location, getting progression levels, etc.). Users spend virtual currency when calling a ConsumeInventoryItem SDK method.

Configurer le module Objets virtuels

Note
The SDK methods support the following types of items:
  • Consumable item — an item in the inventory that can be accrued or purchased repeatedly and decreases in its number once used. The item stock can be replenished. Example: grenades and bullets to attack the opponents, first aid kits, etc.
  • Nonconsumable — an item in the inventory that can be accrued or purchased only once and doesn’t disappear from the inventory. Example: access to a location, status, etc.
  • Nonrenewing subscription — a nonconsumable item that is available for a limited period of time and doesn’t disappear from the inventory when it expires. For example, premium access or season access. For more details, see In-Game Store documentation.
  1. Open your project in Publisher Account.
  2. Click Connect in the Store pane. You can go to the In-Game Store settings from any section of Publisher Account by clicking the Store in the side menu.
  1. Click Connect in the Virtual Items pane.
  1. Click Create a group.
  1. Specify Group code and Group name.
  2. Set the Show group in Store toggle to On.
  3. Click Create group.
  1. Create items:
    1. Specify the following info for each of them:
      • one or more groups that the item should belong to
      • SKU
      • name and a short description
      • prices in real and virtual currencies
      • image (optional)
    1. In the Item property field of the Preferences section, select one of the following properties depending on the type of item:
      • consumable
      • nonconsumable
      • nonrenewing subscription
    2. Click Create an item.
  1. Make sure that the group status is Enabled.

Configurer un projet Unity

  1. Open your Unity project.
  2. Click Window > Xsolla > Edit Settings in the main menu.
  3. Specify project parameters in the Inspector panel:
    1. In the Login ID field, specify the Login ID from Publisher Account.
Note
If you use your own authorization system, you do not need to fill in the Login ID field.
    1. In the Project ID field, specify the Project ID from Publisher Account.
    2. To enable sandbox mode, check the Enable sandbox? box.
    3. In the Authorization method field, select OAuth2.0.
    4. In the OAuth2.0 client ID field, specify Client ID received when setting up OAuth 2.0 in Publisher Account.

As a result, your project in Publisher Account will be connected to the demo scene.

  1. Launch the demo scene Assets > Xsolla > DemoCommon > Scene > Xsollus and make sure that the authorization and other functions are working correctly.
  2. Design an interface for the login system, in-game store, and other pages for your application.
Note
You can create your own solution by following Unity instructions, or use the demo scene as a template. To adapt the demo scene interface to your application, use the UI builder.
  1. Set up event handling according to your application logic using SDK methods. Follow the step-by-step tutorials to get started with basic SDK features.

Tester le processus de paiement

After successfully configuring the asset, test the payment process. By default, all payments are made in sandbox mode for any users. Use a test bank card to simulate a successful payment process.

Test the payment process by making real payments:

  1. Make sure that you have signed a contract with Xsolla.
  2. In your Unity project, uncheck the Enable sandbox? box in the Inspector panel.

Note
After the first real payment is made, a strict sandbox payment policy takes effect. A payment in the sandbox mode is available only to users who are specified in Publisher Account > Company settings > Users.
Cet article vous a été utile ?
Merci !
Que pouvons-nous améliorer ? Message
Nous sommes désolés de l'apprendre
Dites-nous pourquoi vous n'avez pas trouvé cet article utile. Message
Merci pour votre commentaire !
Nous examinerons votre message et l'utiliserons pour améliorer votre expérience.

Poursuivre la lecture

Dernière mise à jour: 22 Janvier 2024

Faute de frappe ou autre erreur dans le texte ? Sélectionnez le texte concerné et appuyez sur Ctrl+Entée.

Signaler un problème
Nous améliorons continuellement notre contenu grâce à vos commentaires.
Indiquez votre adresse e-mail pour un suivi
Merci pour votre commentaire !