Set up Payments Android SDK

To integrate the Xsolla Payments 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.

After the integration is complete, test the payment process.

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

Install 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 Payments Android SDK:

Latest version:

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

Copy
Full screen
Small screen
<string name="xsolla_payments_redirect_scheme">https</string>
<string name="xsolla_payments_redirect_host">example.com</string>
<string name="xsolla_payments_redirect_path_prefix">/payment</string>

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

Test the payment process

After successful 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:

  • Make sure that you have signed a contract with Xsolla.
  • Set .isSandbox(false) while building a Paystation Intent.

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.