Create order

An order consists of items a user wants to buy in the store. After an order is paid, the user receives the items. To make a payment, a user must be authorized in the game.

Integrate Xsolla Login:

  1. Create a project.
  2. Set up your Login project in Publisher Account.
  3. Connect user data storage.
  4. Integrate the solution on your application side.

Using the configured Login method, create and save the authentication token to receive a payment token. The payment token is used for opening the payment UI and making the payment.

To test the payment flow, create an order using the Create order with specified item API call:

  1. If you want to perform a test on the API documentation website, click Try it to open the interface for creating a request.
  2. In the Security block, in the Bearer Token field, enter the token obtained while passing the authentication procedure.
  3. In the Body block, pass order details, e.g., quantity of item quantity. To access sandbox mode, pass "sandbox": true.
  4. In the Parameters block, pass:

In the response, you will receive data you need for further work:

  • token — payment token

Request example:

Copy
Full screen
Small screen
    curl -i -X POST \
      'https://store.xsolla.com/api/v2/project/{project_id}/payment/item/{item_sku}' \
      -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
      -H 'Content-Type: application/json' \
      -d '{
        "sandbox": true,
        "quantity": 5,
        "settings": {
          "ui": {
            "theme": "63295a9a2e47fab76f7708e1",
          }
        },
        "custom_parameters": {
          "character_id": "ingameUsername"
        }
      }'
    
    Note
    To call the Xsolla API, you can use the ready-made SDK methods for game engines and platforms:
    Your progress
    Thank you for your feedback!
    Last updated: January 31, 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!