Set up Store Unity SDK

To integrate the Store Unity SDK:

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

After the integration is complete, test the payment process.

Set up the Virtual Currency module in Publisher Account

Note:
The SDK 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 Consume item API method.

To set up the Virtual Currency module in Publisher Account:

  1. Open your project and click Connect in the Store block. You can go to the Store settings from any section of Publisher Account by clicking the Store button in the left-hand-side menu.

  1. Click Connect in the Virtual Currency block.

  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.

Set up the Virtual Items module in your Publisher Account

The SDK supports 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 does not 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 disappears from the inventory when it expires. For example: premium access or season access. See the nonrenewing subscriptions recipe for more details.

To set up the Virtual Items module in your Publisher Account:

  1. Open your project and click Open in the Store block. If you haven’t connected Store yet, 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:
    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

  1. Make sure that the group status is Enabled.

Set up the asset for your Unity project

  1. Click Window > Xsolla > Edit Settings in the main menu. In the Inspector window:
    1. Specify the Login ID.
    2. Specify the Project ID.
    3. Check the Enable sandbox box.

  1. Go to Assets > Xsolla > DemoCommon > Scene > Xsollus and create a new user. Check for the confirmation email.

  1. Log in as a new user and change the password if necessary.

After the integration is complete, you can use the demo scene as a template and create your own solution based on it. To do this:

  1. Follow user interface tutorials for Unity to customize the scene.
  2. Set up events processing and SDK methods.

Test the payment process

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

  • Make sure that you have signed a contract with Xsolla.
  • In your Unity project, uncheck the Enable sandbox box in the Inspector window.

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.