Set up selling items

Selling items

You can sell items in the following ways:

  1. Fast purchase of one item. In this case, you can sell one SKU in any quantity (for example, 100 identical potions or a custom amount of virtual currency).
  2. Buying a cart. In this case, the player can pre-fill a cart, add or remove items, or change their quantities.

Fast purchase

  1. Call the Create order with specified item API. A token for opening the payment UI will be passed to the response.
  2. Open payment UI using received payment token.
Note
The information about the discount (personalized or related to the purchase) will be available to the user only in the payment UI. The use of promo codes is not provided.
Note
To call the Xsolla API, you can use the ready-made SDK methods for game engines and platforms:

Cart purchase

Implement the logic:
  1. To set up a cart and get the token:
  2. 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.

  1. 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.
  2. 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.
  3. Open payments UI.
Note
To call the Xsolla API, you can use the ready-made SDK methods for game engines and platforms:

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:

  1. Change the cart:

Note
If you want to get current status of the cart, call the Get current user’s cart API.
  1. 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.
  2. 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:

Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Last updated: November 8, 2024

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!