How to use new Commerce API methods
How it works
You can connect the
- If you have already implemented server integration (integration with token) with Xsolla but you want to switch to new Commerce API methods
- If you want to implement the server part of your store for a new start
- Authorization via Xsolla Login
- Authorization via Pay Station access token
- Virtual items management
- User inventory management
- Cart and order management
Who can use it
- Partners who develop a store interface and want to use a third-party solution to implement the server side.
- Partners who have already implemented server integration with Xsolla and want to connect Store with new
How to get it
To connect the
- Set up the Virtual Items module in your Publisher Account.
- Set up authentication.
- Implement methods for store management.
For integration you will need the Project ID or Merchant ID shown in Project settings > Webhooks.
The following user authentication options are available:
- Via Xsolla Login. Choose this option if you have not implemented server integration with Xsolla.
- Via Pay Station access token. Choose this option if you have implemented server integration with Xsolla.
Authentication via Xsolla Login
- Set up a project in Publisher Account.
- Implement the call of the authorization methods with the help of the JSON Web Token or OAuth 2.0 protocol.
If the user data is kept in the Xsolla data storage, implement the call of the following methods:
- Register (JWT or OAuth 2.0)
- Authentication (any of the following):
- Reset password
If the user data is kept in the PlayFab data storage, use the PlayFab how-to.
If the user data is kept on your side, use the Custom storage how-to.
Authentication via Pay Station access token
- Your application (client) sends the authentication request to your server.
- Your server requests authorization token and sends the header containing project_id/merchant_id and api_key parameters to the Xsolla server.
- Xsolla server sends authorization token in the parameter access_token to your server.
- Your server sends the parameter access_token to your client.
The returned access_token is used as an authorization token for authentication in the
Store management methods
You should implement base store management methods:
Get list of items management
- Get virtual items list — to show the full list of virtual items added to your store
- Get item groups list — to show the full list of groups of virtual items added to your store
- Get bundles — for building a catalog:
Cart and order management
- Get cart — for purchasing virtual items — Get cart by ID or Get current user’s cart. Parameter card_id will be used to add or remove items.
- Get order — to determine if the purchase has already been processed. The following order statuses are possible:
- New — order is created but not paid
- Paid — order is paid
- Canceled — order is canceled
- Done — order is paid and the item is added to the inventory
- Creates item purchase using virtual currency — to buy virtual items by virtual currency
- Create order with all items — implement one of the API methods:
The created order will receive a New order status.
To open the payment UI in a new window, use the following link:
ACCESS_TOKEN is the token received when the order was created.
To test the payment process:
- Use the following URL:
- Set the sandbox parameter to true in the request.
- Use the list of bank cards for testing.
User inventory management
- Get user’s inventory — to get a list of items added to the inventory after the purchase
- Get current user virtual balance — to get information about the current user’s virtual balance
- Get current user subscription — to get information about current user’s subscriptions
Was this article helpful?
Rate this page
Don't want to answer
Thank you for your feedback!
Found a typo or other text error? Select the text and press Ctrl+Enter.