Get started

This integration option allows you to take advantage of Xsolla Pay Station if you use a third-party backend solution.

After integrating Xsolla SDKs, you can use Xsolla Pay Station for processing in-game purchases in combination with other BaaS providers responsible for game logic.

Currently, Xsolla provides integration with PlayFab services.

Requirements

System requirements

  • 64-bit OS
  • Windows 7 SP1 and higher
  • macOS 10.12 and higher
  • A compatible version of Unity:
    • 2018.4.30f1
    • 2019.3.4f1

Target OS

  • iOS
  • Android
  • macOS
  • Windows 64-bit
Additionally, the SDK supports creating WebGL build to run your application in a browser.
Note:
We recommend you use the Mono compiler for desktop platforms as it's compatible with the provided in-game browser. If you use other browser solutions, you can use the IL2CPP compiler instead. To create game builds for Android, you can use either Mono or IL2CPP compilers.

Charge policy

Xsolla offers the necessary tools to help you build and grow your gaming business, including personalized support at every stage. The terms of payment are determined by the contract that can be signed via Publisher Account.

The cost of using all Xsolla products is 5% of the amount you receive for the sale of the game and in-game goods via the Xsolla Pay Station. If you do not use the Xsolla Pay Station in your application, but use other products, contact your Account Manager to clarify the terms and conditions.

Prerequisites

Before integrating the Payments Unity SDK with the PlayFab service, follow these steps:

  1. Install the asset.
  2. Set up the project in your Publisher Account.
  3. Set up a project in PlayFab.

Install the asset

  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 from Unity Asset Store or GitHub.

  1. Add a Login demo scene in build settings:
    1. Go to Assets > Xsolla > PlayfabIntegrationDemo > LoginDemo > Scenes and launch the Login scene.
    2. Open File > Build settings and click Add Open Scenes.
  2. Do the same for the Store demo scene found in Assets > Xsolla > PlayfabIntegrationDemo > StoreDemo > Scenes folder.
  3. Check that demo scenes are added in the following order:
    • 0 - Login
    • 1 - Store
  4. Make sure that only the Login scene remains open in the Hierarchy window.

  1. Make sure that the Mono compiler is used for creating a game build (optional):
    1. Click Edit > Project Settings in the main menu.
    2. Go to Other Settings > Configuration block.
    3. Make sure that Mono is chosen in the Scripting Backend field.

After installing the asset, launch the demo scene showing the joint use of the Payments Unity SDK with the PlayFab service.

Set up the project in your Publisher Account

  1. Register an Xsolla Publisher Account.
  2. Configure a Publisher Account project that is automatically created after the previous step:
    1. Click My game in the Projects block and go to Project settings.
    2. In setup mode, specify a Project name and click Save.

    1. Go to Integration settings and check that the Integrate Commerce API toggle is set to Off.

    1. Select the PlayFab integration option.
    2. Click Save.

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

  • Merchant ID found in Publisher Account > Project settings > Webhooks.

  • API key found in Publisher Account > Company settings > API key.

  • Project ID found in Publisher Account > Project settings > Project ID.

Set up the project in PlayFab

  1. Create a PlayFab account.
  2. Set up a project created automatically after registration:
    1. Click the ⚙ icon to the right of the My Game project to open the menu. Click Edit title info.
    2. Specify Name and click Save title.

  1. Go to the project settings and click Add-ons.
  2. Select the Xsolla add-on in the Monetization section.
  3. Click Install Xsolla.
  4. Specify an email to receive notifications, Merchant ID, Project ID, and API key and enable the I agree to the Xsolla Terms and Conditions option.
  5. Indicate whether you want to use the sandbox mode when processing payments (this setting can be changed later).
  6. Click Install Xsolla.

PlayFab must approve a new add-on. The PlayFab team will send you a message to the specified email when it happens.

During the integration process you will need a Title ID. You can find it in the project settings in Title Settings > API Features section or in the address bar of the browser when navigating to the project settings.

Set up the project in your Publisher Account

  1. Register an Xsolla Publisher Account.
  2. Configure a Publisher Account project that is automatically created after the previous step:
    1. Click My game in the Projects block and go to Project settings.
    2. In setup mode, specify a Project name and click Save.

    1. Go to Integration settings and check that the Integrate Commerce API toggle is set to On.

You will need the following parameters for the integration:

  • Merchant ID found in Project settings > Webhooks.

  • API key found in Company settings > API key section.

  • Project ID found in Project settings > Project ID.

  • Secret key found in Project settings > Webhooks section.

Demo

We provide demo scene to demonstrate the integration of the Payments Unity SDK with the PlayFab service. It is available in the Assets > Xsolla > PlayfabIntegrationDemo folder. Use it as an example.

By default, the demo uses parameters of preset PlayFab and Publisher Account projects.

Default values for the demo:

KeyValue
Title ID2915B
Usernamexsolla
Passwordxsolla
Merchant ID136551
Project ID58866

To test the purchase process, launch the Login demo scene from the Assets > Xsolla > PlayfabIntegrationDemo > LoginDemo > Scenes folder. If authentication is successful, the Store demo scene will open for the default user and the user’s preset project.

Limitations:

  • Demo supports the purchase of individual items only. Shopping cart is not available.
  • A nonconsumable item may exist in more than one instance in the inventory.

Integration flow

To integrate the Payments Unity SDK with PlayFab:

  1. Set up a product catalog in PlayFab, add items to the catalog. For the next steps of integration, you will need the Item ID of the created goods.
  2. Add a script to receive a payment token.
  3. Set up webhooks.

  1. Set up the Virtual Items module in your Publisher Account.
  2. Set up virtual currency packages in your in-game store (optional).
  3. Set up the asset for your Unity project.

After the integration is complete, test the payment process.

Continue reading