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:
- Create a project.
- Set up your Login project in Publisher Account.
- Connect user data storage.
- 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:
- If you want to perform a test on the API documentation website, click
Try it to open the interface for creating a request. - In the
Security block, in theBearer Token field, enter the token obtained while passing the authentication procedure. - In the
Body block, pass order details, e.g., quantity of item quantity. To access sandbox mode, pass"sandbox": true
. - In the
Parameters block, pass:project_id
— project ID that you can find in Publisher Account.item_sku
— item SKU.
In the response, you will receive data you need for further work:
token
— payment token
Request example:
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"
}
}'
Found a typo or other text error? Select the text and press Ctrl+Enter.