Integrate store into game
After you have created and configured goods (virtual items, virtual currencies, bundles, keys) in your Publisher Account, add an In-Game Store to your game:
Display of items catalog
Implement a display of items catalog via In-Game Store & Buy Button API calls:
|To display a complete list of virtual items added to your Store||Get virtual items list|
|To display a list of groups of virtual items available for sale on the client side||Get item groups list|
|To get a list of virtual currencies available for sale in your Store on the client side||Get virtual currency list|
|To display a complete list of virtual currency packages added to your Store on the client side||Get virtual currency package list|
|To display a complete list of virtual currency bundles added to your Store||Get list of bundles|
You can sell items in the following ways:
- Fast purchase of one item. In this case, you can sell one SKU in any quantity. For example, 100 identical potions.
- Buying a cart. In this case, the player can pre-fill a cart, then add or remove items, or change their quantities.
- Call the Create order with specified item API. A token for opening the payment UI will be passed to the response.
- Open payment UI using received payment token.
Implement the logic:
- To set up a cart and get the token:
- To open payment UI.
Set up and purchase a cart on the client
Implement the logic of adding and removing items by yourself. You also need to consider that before calling API for setting up a cart, you will not have information about which promotions will be applied to the purchase. This means that the total cost and details of the added bonus items will not be known.
- After the player has filled a cart, call the Fill cart with items API. The current information about the selected items (prices before and after discounts, bonus items) will be passed to the response.
- Call the Create order with all items from current cart API. The order ID and payment token will be passed to the response. The created order will receive a New order status.
- Open payments UI.
Set up and purchase a cart on server
This variant may take longer for setting the cart up, since each change to the cart must be accompanied by API calls.
Complete the following steps:
- Change the cart:
- Call the Create order with all items from the current cart API. The order ID and payment token will be passed to the response. The created order will receive a New order status.
- Open payment UI.
Opening the payment interface
For paying items, open the payment UI. A token for opening the payment UI will be passed to the Create order with all items from current cart API response.
Implement the opening of the payment UI in one of the following ways:
- In a new window. To open the payment UI in a new browser window, use the link:
ACCESS_TOKENis the token received when the order was created.
- Via widget. Use the Xsolla PayStation Widget script (README file contains instructions).
Testing payment process
You can test payment flow in the Sandbox mode. You can use a test bank card and any account.
Found a typo or other text error? Select the text and press Ctrl+Enter.