Keys sale restrictions
How it works
You can limit the number of game keys that a user can purchase.
If the user has reached the specified limit, additional keys will not be available for purchase and an error with the code 0401-1421
is returned. In this case, you need to display information to the user about reaching the purchase limit.
You can display the maximum available number and remaining number of game keys that is available to the user.
As keys are sold, you will be notified by email when there are 25%, 10%, and 0% uploaded keys left in each package. You will be notified if you have one of the following roles in Publisher Account:
- developer
- owner
Only a project owner can change roles in Publisher Account in the Company settings > Users section.
Xsolla ensures the limits are not exceeded and prevents users from purchasing more game keys than the set limit.
When opening the payment interface and paying for a game key, all unpaid orders with this key become invalid.
Example: the user can open the payment form for a game key with a purchase restriction in several browser tabs until the key has been purchased. This automatically results in the creation of multiple orders for the same game key. After purchasing a game key in one tab, Xsolla will void all unpaid orders with the same key.
How to get it
To set a purchase limit when creating a game key package in Publisher Account, switch the Limit number of times one user can buy game key toggle to On and specify the number of times the key that can be purchased.
You can use the methods of the Catalog subsection from the Game keys method group to get information about game keys.
In the response, you will receive the following information in addition to information about the game key:
- the maximum number of game keys a user can buy
- the remaining number of game keys available for the user to purchase
Example of a response with user attributes:
- json
{
"sku": "game_1",
"name": "Game name",
"groups": [
{
"external_id": "all",
"name": "All games"
},
{
"external_id": "Xsolla",
"name": "Xsolla games"
}
],
"type": "game_key",
"description": "Game description",
"image_url": "https://cdn.xsolla.net/img/misc/images/b79342cdf24f0f8557b63c87e8326e62.png",
"attributes": {
"$ref": "../components/examples/client-attribute-game-horror.yaml#/value"
},
"is_free": false,
"price": {
"amount": "30.5",
"amount_without_discount": "30.5",
"currency": "USD"
},
"virtual_prices": [],
"can_be_bought": true,
"drm_name": "Steam",
"drm_sku": "steam",
"has_keys": true,
"is_pre_order": true,
"release_date": "2020-08-11T10:00:00+03:00",
"limits": {
"per_user": {
"total": 5,
"available": 5
},
"per_item": null
},
}
Found a typo or other text error? Select the text and press Ctrl+Enter.