Xsolla servers integration

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
Discord server
Connect with the Xsolla team and developers who use Xsolla products.
You don’t need to configure your own server side for these tasks.

Integration flow

To integrate the Payments library:
  1. Download and install Android Studio.
  2. Create a new project.
  3. Set up the project in your Publisher Account.
  4. Set up the Virtual Currency module (optional).
  5. Set up the Virtual Items module (optional).
  6. Set up Pay Station.
  7. Get a token.
  8. Install the library.
  9. Configure Return URL.
  10. Set up event processing and SDK methods.
After the integration is complete, test the payment process.
This guide describes the minimum settings required to quick-start the module. For any questions, contact your Account Manager.

Set up project in your Publisher Account

  1. Sign up to Publisher Account.
  2. Configure a Publisher Account project. The first project is automatically created after you sign up for an account:
    1. In the Projects section, select your project and go to Project settings.
    2. In the General settings tab, add the following:
      • image (optional)
      • project languages (English is set by default)
      • project name for all specified languages
      • game website (optional)
      • project description (optional)
    3. Click Save.

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

  • Project ID found in Project settings > Project ID.

  • Login ID found in Login settings > Login ID. It has the UUID format.

Set up Virtual Currency module

  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.

The library 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 Xstore.consumeItem SDK method.

Set up Virtual Items module

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.

Set up Pay Station in Publisher Account

  1. Go to your project and click Open in the Pay Station block. If you have not previously installed the Store module, click Connect in the Pay Station block.

  1. Open Pay Station settings.
  2. Specify Return URL and Redirect conditions in the Redirect policy block and click Save.

Get token

You need a token to make the SDK work properly. An access token is a string that is used to initiate the payment process.

You can get a token using Create Order with All Items from Particular Cart method from Xsolla Store library. Or you can use another access token, e.g. the token received from PlayFab.

Install library

The library is available in Maven Central.

To install the library:

  1. Start Android Studio.
  2. Open build.gradle file of your application.
  3. Add the following line to the dependencies section, where <version_number> is the required version of the Payments library:

Latest version:

Full screen
Small screen
implementation 'com.xsolla.android:payments:<version_number>'

Configure Return URL

Add the following strings to the project’s strings resources file to specify the Return URL configured in Publisher Account.

Full screen
Small screen
<string name="xsolla_payments_redirect_scheme">app</string>
<string name="xsolla_payments_redirect_host">yourgame</string>

There you should set the Return URL split into parts. The example is for app://yourgame.

Test payment process

After successfully configuring the library, test the payment process. By default, all payments are in the sandbox mode and you can 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. Set .isSandbox(false) while building a Paystation Intent.

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.
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.
Rate this page
Rate this page
Is there anything we can improve?

Don’t want to answer

Thank you for your feedback!

Continue reading

Last updated: September 1, 2021

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!