Android SDKs

You can use the Xsolla Android SDK to integrate Xsolla products with Android apps.

System Requirements

  • Android OS 5.0 or higher
  • Internet сonnection is essential for the Xsolla Android SDKs

Prerequisites

  1. Download and install Android Studio.
  2. Create a new project.
  3. Create your Xsolla Publisher Account.
  4. Set up a Publisher Account project created automatically after creating the Publisher Account:
    1. Click My game in Projects block and go to Project settings.
    2. In setup mode specify Project name and click Save.
    3. Go to Integration settings and check that the Integrate new Store management methods toggler is enabled.

You can create a new project by clicking the + icon in the Projects block.

Login Android SDK

The Login Android SDK is used to integrate Xsolla Login API methods with Android apps. Main features:

  • authentication via email/username and password
  • authentication via the following social networks:
    • Google
    • Facebook
    • Twitter
    • Linkedin
    • Naver
    • Baidu
  • signup
  • email confirmation
  • password reset

Integration

To integrate the Login Android SDK:

  1. Set up Xsolla Login in your Publisher Account. You will need a Login ID, found in Login settings > Login ID. It has the UUID format.

  1. Install and initialize the library.
  2. Set up event processing and SDK methods.

Setting up Login in Publisher Account

  1. Go to your project and click Connect in the Login block.

  1. Go to Login projects and click New Login.

  1. Specify a Login name and click Create.

  1. Go to General settings > URL block and specify the Callback URL which the user is redirected to after the email confirmation or password reset.
  2. Select the Xsolla storage in the User data storage block.

Installing the Library

The library is available in JCenter.

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 Login Android SDK:

implementation 'com.xsolla.android:login:<version_number>'

Initializing the Library

To initialize the library:

  • If you did not specify the Callback URL in your Publisher Account, add the following line to your android project source code:

XLogin.init("login-project-id", context);

Note: The default Сallback URL is https://login.xsolla.com/api/blank.

  • if you specified Callback URL in your Publisher Account, add the following line to your android project source code:

XLogin.init("login-project-id", "your-callback-url", context);

Store Android SDK

The Store Android SDK is used to integrate Xsolla Store API methods with Android apps.

The solution is used for:

  • managing your in-game store
  • selling virtual items

Before using the plugin, you need to set up Store and Login modules in your Publisher Account. For integration you will need:

  • Project ID found in Project settings > Project ID.

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

Integration

To integrate the Store Android SDK:

  1. Set up the Virtual Items module in your Publisher Account.
  2. Install and initialize the library.
  3. Set up event processing and SDK methods.
  4. Integrate the Xsolla Pay Station Android SDK and test the payment process.

Setting up the Virtual Items module in your Publisher Account

  1. Go to your project and click Connect in the Store block.

  1. Click Connect in the Virtual Items block.

  1. Click Create a group.

  1. Specify Group code and Group name, turn on the group display in Store. Click Create group.

  1. Create items, specifying 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 currencie
    • image (optional)

  1. Make sure that the group status is Enabled.

Installing the Library

The library is available in JCenter.

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 Pay Station Android SDK:

implementation 'com.xsolla.android:store:<version_number>'

Initializing the Library

To initialize the library, add the following line to your Android project source code:

XStore.init(storeProjectId, authToken);

Pay Station Android SDK

The Pay Station Android SDK is used to integrate Xsolla Pay Station API methods with Android apps.

Integration

To integrate the Xsolla Pay Station SDK:

  1. Set up the Store module (optional).
  2. Set up Pay Station in your Publisher Account.
  3. Get a token.
  4. Install the library.
  5. Configure Return URL.
  6. Set up event processing and SDK methods.
  7. Test the payment process.

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

Getting a Token

You need to get 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 SDK. Or you can use another access token, e.g. the token received from PlayFab.

Installing the Library

The library is available in JCenter.

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 Pay Station Android SDK:

implementation 'com.xsolla.android:paystation:<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.

<string name="xsolla_paystation_redirect_scheme">https</string>
<string name="xsolla_paystation_redirect_host">example.com</string>
<string name="xsolla_paystation_redirect_path_prefix">/payment</string>

There you should set the Return URL split into three parts. The example is for https://example.com/payment.

Testing the Payment Process

After a successful configuration of the library you can 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.

To test the payment process by making real payments, be sure that you have signed a contract with Xsolla and set PaymentOptions.setSandbox(false) while building Pay Station intent.