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.

Call the Create payment token for purchase API method and pass information about a user and items in this method. You can use this API call to sell single and multiple items.

To use sandbox mode, pass the “sandbox”: true parameter in the body of the request for getting a token.

Note
The value of the user_id parameter:
  • When testing, you can pass any symbol in this parameter.
  • To accept real payments, pass the user ID from your system in this parameter. This ID is passed in the User validation webhook.
Request example:
Copy
Full screen
Small screen
    curl -i -X POST \
      -u 224575:MYAPIKEY \
      https://store.xsolla.com/api/v2/project/224575/admin/payment/token \
      -H 'Content-Type: application/json' \
      -d '{
        "user": {
          "id": {
            "value": "myUserID"
          }
        },
        "purchase": {
          "items": [
            {
              "sku": "mySKU",
              "quantity": 1
            }
          ]
        },
        "sandbox": true
      }'
    
    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!