Store API v2.0

Overview

This section describes methods for working with Store modules. Use basic authentication to call methods. To open the Store UI and enable secure payments you first need to get a token.

Endpoint path: https://api.xsolla.com.

Store UI

Opening Store

Use the following link to open the store UI in a new window: https://secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN, where ACCESS_TOKEN is the token received via API.

Use the following URL for testing purposes: https://sandbox-secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN.

Notice: Parameter access_token contains private user data. Please make sure that you use server-to-server communication when getting this parameter.

Test Cards List

In the Sandbox you can use these cards to simulate successful payments:

Card 3-D Secure
Card number: 4111111111111111
Exp. date: 12/20
CVV2: 123
Card type: VISA
No
Card number: 5555555555554444
Exp. date: 11/19
CVV2: 321
Card type: MasterCard
No
Card number: 4000000000000010
Exp. date: 12/20
CVV2: 123
Card type: VISA
Yes
Card number: 5200000000000114
Exp. date: 11/19
CVV2: 321
Card type: MasterCard
Yes
Card number: 6759649826438453
Exp. date: 12/25
CVV2: 321
Card type: Maestro
Yes

In addition, you can use the following data to simulate declined transactions:

Card 3-D Secure Description
Card number: 4000000000000002
Exp. date: 12/20
CVV2: 123
Card type: VISA
No Insufficient funds
Card number: 5200000000000007
Exp. date: 11/19
CVV2: 321
Card type: MasterCard
No Insufficient funds
Card number: 4000000000000036
Exp. date: 12/20
CVV2: 123
Card type: VISA
Yes Declined
Card number: 5200000000000031
Exp. date: 11/19
CVV2: 321
Card type: MasterCard
Yes Declined

Errors List

Code Description
0004-0001 Token expired or incorrect.
0004-0008 Wrong URL (trying to access sandbox mode at secure.xsolla.com or live mode at sandbox-secure.xsolla.com).
0002-0004 Agreement not signed.
0004-0010 Tokenless integration prohibited.
0010-0001 Package not found.
0010-0003 Package has no DRM configured.
1000-0003 No modules turned on for the project.

Virtual Currency

Get Package

Gets a virtual currency package by ID.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}

Parameter Type Description
project_id
integer Project ID.
package_id
integer Virtual currency package ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}
{
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 100,
  "bonus": 1,
  "description": null,
  "enabled": true,
  "id": 37702,
  "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
  "label": null,
  "prices_array": [
    {
      "name": "EUR",
      "value": 0.99
    }
  ],
  "sku": null
}

Update Package

Updates a project's virtual currency package.

HTTP REQUEST

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}

Parameter Type Description
project_id
integer Project ID.
package_id
integer Virtual currency package ID.
vc_name
array of strings Product name. Value consists of pairs "localization":"product name".
base
array Main product currency (object). Key = currency name (3 letters per ISO 4217); value = amount in that currency.
default_currency
string Default currency.
min
float Minimum purchase amount.
max
float Maximum purchase amount.
is_currency_discrete
boolean Whether to enable decimal units for the virtual currency.
allow_user_sum
boolean Whether the user can pay an arbitrary amount for the package.
amount
float Quantity of the virtual currency in the package.
sku
string Unique ID of the virtual currency package.
price
float Price of the package.
image_url
string Image URL.
description
array of strings Array with localized package names. Value consists of pairs "localization":"package description".
label
array of strings Localized package labels (array). Value consists of pairs "localization":"package description".
bonus
float Discount for the package (%).
advertisement_type
string Type of label to be used for the package. Can be 'recommended', 'best_deal', 'special_offer', or 'null'.
enabled
boolean Enables the virtual currency package.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 1010,
  "bonus": 40.01,
  "description": null,
  "enabled": true,
  "image_url": "//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png",
  "label": null,
  "prices_array": [
    {
      "name": "RUB",
      "value": 59.99
    }
  ],
  "sku": null
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"advertisement_type":null,"advertisement_type_custom":null,"amount":1010,"bonus":40.01,"description":null,"enabled":true,"image_url":"//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png","label":null,"prices_array":[{"name":"RUB","value":59.99}],"sku":null}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"advertisement_type":null,"advertisement_type_custom":null,"amount":1010,"bonus":40.01,"description":null,"enabled":true,"image_url":"//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png","label":null,"prices_array":[{"name":"RUB","value":59.99}],"sku":null}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"advertisement_type\":null,\"advertisement_type_custom\":null,\"amount\":1010,\"bonus\":40.01,\"description\":null,\"enabled\":true,\"image_url\":\"//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png\",\"label\":null,\"prices_array\":[{\"name\":\"RUB\",\"value\":59.99}],\"sku\":null}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"advertisement_type\":null,\"advertisement_type_custom\":null,\"amount\":1010,\"bonus\":40.01,\"description\":null,\"enabled\":true,\"image_url\":\"//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png\",\"label\":null,\"prices_array\":[{\"name\":\"RUB\",\"value\":59.99}],\"sku\":null}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"advertisement_type\":null,\"advertisement_type_custom\":null,\"amount\":1010,\"bonus\":40.01,\"description\":null,\"enabled\":true,\"image_url\":\"//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png\",\"label\":null,\"prices_array\":[{\"name\":\"RUB\",\"value\":59.99}],\"sku\":null}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"advertisement_type\":null,\"advertisement_type_custom\":null,\"amount\":1010,\"bonus\":40.01,\"description\":null,\"enabled\":true,\"image_url\":\"//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png\",\"label\":null,\"prices_array\":[{\"name\":\"RUB\",\"value\":59.99}],\"sku\":null}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "advertisement_type": null,
  "advertisement_type_custom": null,
  "amount": 1010,
  "bonus": 40.01,
  "description": null,
  "enabled": true,
  "image_url": "//cdn.xsolla.net/img/misc/images/e69ec3dee89b51237aa01a60b4374c23.png",
  "label": null,
  "prices_array": [
    {
      "name": "RUB",
      "value": 59.99
    }
  ],
  "sku": null
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency/packages/{package_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Get Packages

Lists virtual currency info and available packages.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency

Parameter Type Description
project_id
integer Project ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/virtual_currency", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}
{
  "allow_user_sum": true,
  "base": {
    "EUR": 0.01,
    "USD": 0.01
  },
  "default_currency": "USD",
  "id": 40123,
  "image_url": "//cdn.xsolla.net/img/misc/images/91d3aecf770347428c8c6abdc8a260b8.png",
  "is_currency_discrete": true,
  "max": 0,
  "min": 0,
  "packets": {
    "EUR": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": true,
        "id": 37702,
        "image_url": "//cdn.xsolla.net/img/misc/images/19a38b51403c3ab389fabfacdabc43df.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0.2,
        "description": [],
        "enabled": true,
        "id": 37708,
        "image_url": "//cdn.xsolla.net/img/misc/images/fec4d08a1258582d94d50f25c92c125e.png",
        "label": [],
        "price": 4.99,
        "sku": null
      }
    ],
    "USD": [
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 100,
        "bonus": 1,
        "description": [],
        "enabled": false,
        "id": 37701,
        "image_url": "//cdn.xsolla.net/img/misc/images/5eb27983d6a7005a59b1b1b8191e3712.png",
        "label": [],
        "price": 0.99,
        "sku": null
      },
      {
        "advertisement_type": null,
        "advertisement_type_custom": [],
        "amount": 500,
        "bonus": 0,
        "description": [],
        "enabled": true,
        "id": 37707,
        "image_url": "//cdn.xsolla.net/img/misc/images/8574e6bb25b8fa6adac2b73250369646.png",
        "label": [],
        "price": 5.99,
        "sku": null
      }
    ]
  },
  "type": "discounts",
  "vc_name": {
    "de": null,
    "en": "Coins",
    "es": "Monedas",
    "fr": "Monnaies",
    "ko": "코인",
    "ru": "Coins"
  }
}

Virtual Items

Create Item

Creates a virtual item.

HTTP REQUEST

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items

Parameter Type Description
project_id
integer Project ID.
sku
string Unique item ID. The SKU may only contain lowercase Latin alphanumeric characters, dashes, and underscores.
item_code
string Additional item code. Optional.
name
array of strings Localized item names (array).
description
array of strings Localized item descriptions (array).
long_description
array of strings Localized extended descriptions of the item (array).
prices
array Item prices (array).
default_currency
string Default purchase currency. Three-letter code per ISO 4217.
enabled
boolean Enables the item.
permanent
boolean If true, the item can only be purchased once.
image_url
string Image URL.
item_type
string Type of Item: Consumable/Expiration/Permanent/Lootboxes/Physical.
expiration
integer Lifetime in seconds. For Expiration-type items only.
groups
array of integers Groups the item belongs to (array).
deleted
boolean Whether the item was deleted.
user_attribute_conditions
array of objects List of conditions on the user attribute.
user_attribute_conditions.right_operand
array Values to compare the user attribute to.
user_attribute_conditions.user_attribute_key
string Key of the user attribute condition.
user_attribute_conditions.operation
string Type of operation. Can be 'greater', 'greaterOrEqual', 'equal', 'notEqual', 'less', 'lessOrEqual', 'between', 'in', 'notIn'.
user_attribute_conditions.action
string Type of action. Can be 'hide', 'block', 'warning'.
advertisement_type
string Type of a special banner to show for the item in the payment UI. Can be 'recommended', 'best_deal', 'special_offer', 'null'.
virtual_currency_price
integer Price in the in-game currency. If 'null', the item can only be purchased for real currency.
purchase_limit
integer Number of times the item can be purchased. If 'null', there is no limit on the number of purchases.
keywords
array Keywords that can be used to find the item in the payment UI.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "advertisement_type": null,
  "default_currency": "USD",
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "image_url": "",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": {},
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": "1",
    "USD": "2"
  },
  "sku": "1234",
  "user_attribute_conditions": [
    {},
    {},
    {}
  ]
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"name":{"en":"T-34-3"},"description":{"en":"Chinese Tier VIII medium tank."},"long_description":{"en":"This Chinese Tier VIII medium tank is a real beast in its class."},"enabled":true,"item_code":"chinese-medium-tank","advertisement_type":null,"item_type":null,"keywords":{},"groups":[],"default_currency":"USD","expiration":null,"image_url":"","permanent":true,"prices":{"USD":"2","EUR":"1"},"sku":"1234","user_attribute_conditions":[{},{},{}]}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"name":{"en":"T-34-3"},"description":{"en":"Chinese Tier VIII medium tank."},"long_description":{"en":"This Chinese Tier VIII medium tank is a real beast in its class."},"enabled":true,"item_code":"chinese-medium-tank","advertisement_type":null,"item_type":null,"keywords":{},"groups":[],"default_currency":"USD","expiration":null,"image_url":"","permanent":true,"prices":{"USD":"2","EUR":"1"},"sku":"1234","user_attribute_conditions":[{},{},{}]}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"chinese-medium-tank\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"1\"},\"sku\":\"1234\",\"user_attribute_conditions\":[{},{},{}]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"chinese-medium-tank\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"1\"},\"sku\":\"1234\",\"user_attribute_conditions\":[{},{},{}]}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/virtual_items/items", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"chinese-medium-tank\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"1\"},\"sku\":\"1234\",\"user_attribute_conditions\":[{},{},{}]}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"chinese-medium-tank\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"1\"},\"sku\":\"1234\",\"user_attribute_conditions\":[{},{},{}]}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "name": {
    "en": "T-34-3"
  },
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "enabled": true,
  "item_code": "chinese-medium-tank",
  "advertisement_type": null,
  "item_type": null,
  "keywords": {},
  "groups": [],
  "default_currency": "USD",
  "expiration": null,
  "image_url": "",
  "permanent": true,
  "prices": {
    "USD": "2",
    "EUR": "1"
  },
  "sku": "1234",
  "user_attribute_conditions": [
    {},
    {},
    {}
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}

Get Item

Retrieves a virtual item.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}

Parameter Type Description
item_id
integer Item ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}
{
  "advertisement_type": null,
  "default_currency": "USD",
  "deleted": false,
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "id": 163099,
  "image_url": "//cdn.xsolla.net/img/misc/merchant/default-item.png",
  "item_code": "chinese-medium-tank",
  "item_type": null,
  "keywords": [],
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": 1,
    "USD": 2
  },
  "purchase_limit": null,
  "secondary_market": [],
  "sku": "1234",
  "user_attribute_conditions": [],
  "virtual_currency_price": null
}

Update Item

Updates a virtual item.

HTTP REQUEST

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}

Parameter Type Description
item_id
integer Item ID.
sku
string Unique item ID. The SKU may only contain lowercase Latin alphanumeric characters, dashes, and underscores.
item_code
string Additional item code. Optional.
name
array of strings Localized item names (array).
description
array of strings Localized item descriptions (array).
long_description
array of strings Localized extended descriptions of the item (array).
prices
array Item prices (array).
default_currency
string Default purchase currency. Three-letter code per ISO 4217.
enabled
boolean Enables the item.
permanent
boolean If true, the item can only be purchased once.
image_url
string Image URL.
item_type
string Type of Item: Consumable/Expiration/Permanent/Lootboxes/Physical.
expiration
integer Lifetime in seconds. For Expiration-type items only.
groups
array of integers Groups the item belongs to (array).
deleted
boolean Whether the item was deleted.
user_attribute_conditions
array of objects List of conditions on the user attribute.
user_attribute_conditions.right_operand
array Values to compare the user attribute to.
user_attribute_conditions.user_attribute_key
string Key of the user attribute condition.
user_attribute_conditions.operation
string Type of operation. Can be 'greater', 'greaterOrEqual', 'equal', 'notEqual', 'less', 'lessOrEqual', 'between', 'in', 'notIn'.
user_attribute_conditions.action
string Type of action. Can be 'hide', 'block', 'warning'.
advertisement_type
string Type of a special banner to show for the item in the payment UI. Can be 'recommended', 'best_deal', 'special_offer', 'null'.
virtual_currency_price
integer Price in the in-game currency. If 'null', the item can only be purchased for real currency.
purchase_limit
integer Number of times the item can be purchased. If 'null', there is no limit on the number of purchases.
keywords
array Keywords that can be used to find the item in the payment UI.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "advertisement_type": null,
  "default_currency": "USD",
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "enabled": true,
  "expiration": null,
  "groups": [],
  "image_url": "",
  "item_code": "ut et",
  "item_type": null,
  "keywords": {},
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "name": {
    "en": "T-34-3"
  },
  "permanent": true,
  "prices": {
    "EUR": "4",
    "USD": "2"
  },
  "sku": "12394",
  "user_attribute_conditions": [
    {},
    {},
    {}
  ]
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"name":{"en":"T-34-3"},"description":{"en":"Chinese Tier VIII medium tank."},"long_description":{"en":"This Chinese Tier VIII medium tank is a real beast in its class."},"enabled":true,"item_code":"ut et","advertisement_type":null,"item_type":null,"keywords":{},"groups":[],"default_currency":"USD","expiration":null,"image_url":"","permanent":true,"prices":{"USD":"2","EUR":"4"},"sku":"12394","user_attribute_conditions":[{},{},{}]}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"name":{"en":"T-34-3"},"description":{"en":"Chinese Tier VIII medium tank."},"long_description":{"en":"This Chinese Tier VIII medium tank is a real beast in its class."},"enabled":true,"item_code":"ut et","advertisement_type":null,"item_type":null,"keywords":{},"groups":[],"default_currency":"USD","expiration":null,"image_url":"","permanent":true,"prices":{"USD":"2","EUR":"4"},"sku":"12394","user_attribute_conditions":[{},{},{}]}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"ut et\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"4\"},\"sku\":\"12394\",\"user_attribute_conditions\":[{},{},{}]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"ut et\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"4\"},\"sku\":\"12394\",\"user_attribute_conditions\":[{},{},{}]}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}virtual_items/items/{item_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"ut et\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"4\"},\"sku\":\"12394\",\"user_attribute_conditions\":[{},{},{}]}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\":{\"en\":\"T-34-3\"},\"description\":{\"en\":\"Chinese Tier VIII medium tank.\"},\"long_description\":{\"en\":\"This Chinese Tier VIII medium tank is a real beast in its class.\"},\"enabled\":true,\"item_code\":\"ut et\",\"advertisement_type\":null,\"item_type\":null,\"keywords\":{},\"groups\":[],\"default_currency\":\"USD\",\"expiration\":null,\"image_url\":\"\",\"permanent\":true,\"prices\":{\"USD\":\"2\",\"EUR\":\"4\"},\"sku\":\"12394\",\"user_attribute_conditions\":[{},{},{}]}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "name": {
    "en": "T-34-3"
  },
  "description": {
    "en": "Chinese Tier VIII medium tank."
  },
  "long_description": {
    "en": "This Chinese Tier VIII medium tank is a real beast in its class."
  },
  "enabled": true,
  "item_code": "ut et",
  "advertisement_type": null,
  "item_type": null,
  "keywords": {},
  "groups": [],
  "default_currency": "USD",
  "expiration": null,
  "image_url": "",
  "permanent": true,
  "prices": {
    "USD": "2",
    "EUR": "4"
  },
  "sku": "12394",
  "user_attribute_conditions": [
    {},
    {},
    {}
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Delete Item

Deletes a virtual item.

HTTP REQUEST

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}

Parameter Type Description
item_id
integer Item ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Get Items List

Lists all virtual items.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items

Parameter Type Description
project_id
integer Project ID.
offset
integer Number of the element from which the list is generated (the count starts from 0).
limit
integer Limit for the number of elements on the page.
has_price
string Price type: 'virtual_currency' or 'real_currency' if the item can be purchased for virtual or real currency, respectively.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/virtual_items/items", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
HttpResponse<String> response = Unirest.get("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items")
  .header("authorization", "Basic <your_authorization_basic_key>")
  .asString();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]
[
  {
    "advertisement_type": "recommended",
    "default_currency": "USD",
    "enabled": false,
    "groups": [
      9196
    ],
    "id": 163076,
    "localized_name": "Rabbit",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1468",
    "virtual_currency_price": 400
  },
  {
    "advertisement_type": null,
    "default_currency": "USD",
    "enabled": true,
    "groups": [
      9196
    ],
    "id": 163077,
    "localized_name": "Chicken",
    "permanent": false,
    "prices": {
      "CNY": 5.99,
      "EUR": 1,
      "KRW": 999,
      "RUB": 59.99,
      "USD": 1
    },
    "sku": "1469",
    "virtual_currency_price": 600
  }
]

Create Items Group

Creates a virtual item group.

HTTP REQUEST

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups

Parameter Type Description
project_id
integer Project ID.
name
array of strings Localized group names (array).
description
array of strings Localized group descriptions (array).
enabled
boolean Enables the group.
parent_id
integer Parent group ID.
code
integer Group's unique code.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "name": {
    "en": "Animals"
  },
  "parent_id": "9182"
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"name":{"en":"Animals"},"description":{"en":"Farm animals"},"enabled":true,"code":"2","parent_id":"9182"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"name":{"en":"Animals"},"description":{"en":"Farm animals"},"enabled":true,"code":"2","parent_id":"9182"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"name\":{\"en\":\"Animals\"},\"description\":{\"en\":\"Farm animals\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"name\":{\"en\":\"Animals\"},\"description\":{\"en\":\"Farm animals\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/virtual_items/groups", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"name\":{\"en\":\"Animals\"},\"description\":{\"en\":\"Farm animals\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\":{\"en\":\"Animals\"},\"description\":{\"en\":\"Farm animals\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "name": {
    "en": "Animals"
  },
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "code": "2",
  "parent_id": "9182"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}

Get Items Group

Retrieves details on a virtual item group.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}

Parameter Type Description
group_id
string Group ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}
{
  "code": "2",
  "description": {
    "en": "Farm animals"
  },
  "enabled": true,
  "id": 9208,
  "name": {
    "en": "Animals"
  },
  "parent_id": 9182
}

Update Items Group

Updates a virtual item group.

HTTP REQUEST

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}

Parameter Type Description
group_id
string Group ID.
name
array of strings Localized group names (array).
description
array of strings Localized group descriptions (array).
enabled
boolean Enables the group.
parent_id
integer Parent group ID.
code
integer Group's unique code.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "code": "2",
  "description": {
    "en": "Farm animals and plants"
  },
  "enabled": true,
  "name": {
    "en": "Animals and plants"
  },
  "parent_id": "9182"
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"name":{"en":"Animals and plants"},"description":{"en":"Farm animals and plants"},"enabled":true,"code":"2","parent_id":"9182"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"name":{"en":"Animals and plants"},"description":{"en":"Farm animals and plants"},"enabled":true,"code":"2","parent_id":"9182"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"name\":{\"en\":\"Animals and plants\"},\"description\":{\"en\":\"Farm animals and plants\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"name\":{\"en\":\"Animals and plants\"},\"description\":{\"en\":\"Farm animals and plants\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"name\":{\"en\":\"Animals and plants\"},\"description\":{\"en\":\"Farm animals and plants\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\":{\"en\":\"Animals and plants\"},\"description\":{\"en\":\"Farm animals and plants\"},\"enabled\":true,\"code\":\"2\",\"parent_id\":\"9182\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "name": {
    "en": "Animals and plants"
  },
  "description": {
    "en": "Farm animals and plants"
  },
  "enabled": true,
  "code": "2",
  "parent_id": "9182"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Delete Items Group

Deletes a virtual item group.

HTTP REQUEST

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}

Parameter Type Description
group_id
string Group ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Get Items Groups List

Lists all virtual item groups.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups

Parameter Type Description
project_id
integer Project ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/virtual_items/groups", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]
[
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9196,
    "localized_name": "Pets",
    "parent_id": null,
    "virtual_items_count": 8
  },
  {
    "code": null,
    "enabled": true,
    "has_groups": false,
    "has_virtual_items": true,
    "id": 9197,
    "localized_name": "Food",
    "parent_id": null,
    "virtual_items_count": 7
  }
]

User Attributes

Create Attribute

Creates a user attribute.

HTTP REQUEST

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes

Parameter Type Description
project_id
integer Project ID. Required.
key
string Key of the user attribute. Required.
name
array of strings Localized attribute names. Required.
type
string Key type. Can be 'int', 'string', 'enum', or 'date'. Required.
list_of_values
array Array of possible values for enum type. Required.
skip_condition_on_nonexistent_key
boolean Whether to skip the condition if key doesn't exist.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "key": "13",
  "list_of_values": [
    {},
    {},
    {},
    {}
  ],
  "name": {
    "en": "Rating",
    "ru": "Рейтинг"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"key":"13","name":{"en":"Rating","ru":"Рейтинг"},"type":"int","list_of_values":[{},{},{},{}],"visible":false,"skip_condition_on_nonexistent_key":true}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"key":"13","name":{"en":"Rating","ru":"Рейтинг"},"type":"int","list_of_values":[{},{},{},{}],"visible":false,"skip_condition_on_nonexistent_key":true}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"key\":\"13\",\"name\":{\"en\":\"Rating\",\"ru\":\"Рейтинг\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":false,\"skip_condition_on_nonexistent_key\":true}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"key\":\"13\",\"name\":{\"en\":\"Rating\",\"ru\":\"Рейтинг\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":false,\"skip_condition_on_nonexistent_key\":true}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/user_attributes", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"key\":\"13\",\"name\":{\"en\":\"Rating\",\"ru\":\"Рейтинг\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":false,\"skip_condition_on_nonexistent_key\":true}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"key\":\"13\",\"name\":{\"en\":\"Rating\",\"ru\":\"Рейтинг\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":false,\"skip_condition_on_nonexistent_key\":true}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "key": "13",
  "name": {
    "en": "Rating",
    "ru": "Рейтинг"
  },
  "type": "int",
  "list_of_values": [
    {},
    {},
    {},
    {}
  ],
  "visible": false,
  "skip_condition_on_nonexistent_key": true
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}

Get Attribute

Gets details on a specific user attribute.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}

Parameter Type Description
project_id
integer Project ID.
user_attribute_id
integer User attribute ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/11425

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/11425 \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/11425');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/11425");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/user_attributes/11425", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/11425")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/11425")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/11425");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}
{
  "id": 11425,
  "key": "12",
  "list_of_values": [],
  "localized_name": "Level",
  "name": {
    "en": "Level",
    "ru": "Уровень"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": false
}

Update Attribute

Updates a user attribute.

HTTP REQUEST

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}

Parameter Type Description
project_id
integer Project ID.
user_attribute_id
integer User attribute ID.
key
string Key of the user attribute. Required.
name
array of strings Localized attribute names. Required.
type
string Key type. Can be 'int', 'string', 'enum', or 'date'. Required.
list_of_values
array Array of possible values for enum type. Required.
skip_condition_on_nonexistent_key
boolean Whether to skip the condition if key doesn't exist.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "key": "13",
  "list_of_values": [
    {},
    {},
    {},
    {}
  ],
  "name": {
    "en": "User rating",
    "ru": "Рейтинг пользователя"
  },
  "skip_condition_on_nonexistent_key": true,
  "type": "int",
  "visible": true
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"key":"13","name":{"en":"User rating","ru":"Рейтинг пользователя"},"type":"int","list_of_values":[{},{},{},{}],"visible":true,"skip_condition_on_nonexistent_key":true}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"key":"13","name":{"en":"User rating","ru":"Рейтинг пользователя"},"type":"int","list_of_values":[{},{},{},{}],"visible":true,"skip_condition_on_nonexistent_key":true}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"key\":\"13\",\"name\":{\"en\":\"User rating\",\"ru\":\"Рейтинг пользователя\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":true,\"skip_condition_on_nonexistent_key\":true}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"key\":\"13\",\"name\":{\"en\":\"User rating\",\"ru\":\"Рейтинг пользователя\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":true,\"skip_condition_on_nonexistent_key\":true}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"key\":\"13\",\"name\":{\"en\":\"User rating\",\"ru\":\"Рейтинг пользователя\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":true,\"skip_condition_on_nonexistent_key\":true}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"key\":\"13\",\"name\":{\"en\":\"User rating\",\"ru\":\"Рейтинг пользователя\"},\"type\":\"int\",\"list_of_values\":[{},{},{},{}],\"visible\":true,\"skip_condition_on_nonexistent_key\":true}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "key": "13",
  "name": {
    "en": "User rating",
    "ru": "Рейтинг пользователя"
  },
  "type": "int",
  "list_of_values": [
    {},
    {},
    {},
    {}
  ],
  "visible": true,
  "skip_condition_on_nonexistent_key": true
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Delete Attribute

Deletes a user attribute.

HTTP REQUEST

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}

Parameter Type Description
project_id
integer Project ID.
user_attribute_id
integer User attribute ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{attribute_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Get Attributes List

Lists all user attributes.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes

Parameter Type Description
project_id
integer Project ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/user_attributes", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]
[
  {
    "id": 11425,
    "key": "12",
    "list_of_values": [],
    "localized_name": "Level",
    "name": {
      "en": "Level",
      "ru": "Уровень"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "int",
    "visible": false
  },
  {
    "id": 11426,
    "key": "11",
    "list_of_values": [],
    "localized_name": "Class",
    "name": {
      "en": "Class",
      "ru": "Класс"
    },
    "skip_condition_on_nonexistent_key": true,
    "type": "string",
    "visible": false
  }
]

Subscriptions

Create Plan

Creates a subscription plan.

HTTP REQUEST

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans

Parameter Type Description
project_id
integer Project ID.
external_id
string Plan external ID (32 characters). Optional.
name
array of strings Plan name. Value consists of pairs "localization":"plan name".
description
array of strings Plan description. Value consists of pairs "localization":"plan description". Optional.
group_id
string Group ID the plans are linked to.
charge
object Billing details (object).
charge.period
object Billing period (object).
charge.period.value
integer Number of time units.
charge.period.type
string Time unit: day/month.
charge.amount
float Billing amount.
charge.currency
string Currency of the purchase. Three-letter currency code per ISO 4217.
expiration
object Subscription expiration details (object).
expiration.value
integer Validity time.
expiration.type
string Time unit: day/month.
trial
object Trial period details (object). Optional.
trial.value
integer Trial period.
trial.type
string Time unit: day.
grace_period
object Grace period details. Optional.
grace_period.value
integer Grace period.
grace_period.type
string Time unit: day.
tags
array Plan tags. Optional.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "charge": {
    "amount": "10",
    "currency": "USD",
    "period": {
      "type": "month",
      "value": "1"
    }
  },
  "description": {
    "en": "2x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": null
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": "2"
  },
  "name": {
    "en": "Experience boost"
  },
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "trial": {
    "type": "day",
    "value": "7"
  }
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"charge":{"amount":"10","currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"2x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}}}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"charge":{"amount":"10","currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"2x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}}}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/subscriptions/plans", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"charge\":{\"amount\":\"10\",\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"2x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}}}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "charge": {
    "amount": "10",
    "currency": "USD",
    "period": {
      "value": "1",
      "type": "month"
    }
  },
  "name": {
    "en": "Experience boost"
  },
  "description": {
    "en": "2x more experience!"
  },
  "trial": {
    "value": "7",
    "type": "day"
  },
  "grace_period": {
    "value": "2",
    "type": "day"
  },
  "external_id": "exp",
  "expiration": {
    "value": null,
    "type": "day"
  },
  "status": {
    "value": "active",
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    }
  }
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}
{
  "external_id": "exp",
  "plan_id": 241082
}

Update Plan Parameters

Updates subscription plan parameters.

HTTP REQUEST

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Parameter Type Description
project_id
integer Project ID.
plan_id
integer Plan ID.
external_id
string Plan external ID (32 characters). Optional.
name
array of strings Plan name. Value consists of pairs "localization":"plan name".
description
array of strings Plan description. Value consists of pairs "localization":"plan description". Optional.
group_id
string Group ID the plans are linked to.
charge
object Billing details (object).
charge.period
object Billing period (object).
charge.period.value
integer Number of time units.
charge.period.type
string Time unit: day/month.
charge.amount
float Billing amount.
charge.currency
string Currency of the purchase. Three-letter currency code per ISO 4217.
expiration
object Subscription expiration details (object).
expiration.value
integer Validity time.
expiration.type
string Time unit: day/month.
trial
object Trial period details (object). Optional.
trial.value
integer Trial period.
trial.type
string Time unit: day.
grace_period
object Grace period details. Optional.
grace_period.value
integer Grace period.
grace_period.type
string Time unit: day.
tags
array Plan tags. Optional.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • java
  • js
  • python
  • ruby
Request
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": "1"
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": null
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": "2"
  },
  "name": {
    "en": "Experience boost"
  },
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": null,
  "trial": {
    "type": "day",
    "value": "7"
  }
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"charge":{"amount":20,"currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"3x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}},"tags":null}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"charge":{"amount":20,"currency":"USD","period":{"value":"1","type":"month"}},"name":{"en":"Experience boost"},"description":{"en":"3x more experience!"},"trial":{"value":"7","type":"day"},"grace_period":{"value":"2","type":"day"},"external_id":"exp","expiration":{"value":null,"type":"day"},"status":{"value":"active","counters":{"active":0,"canceled":0,"frozen":0,"non_renewing":0}},"tags":null}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "value": "1",
      "type": "month"
    }
  },
  "name": {
    "en": "Experience boost"
  },
  "description": {
    "en": "3x more experience!"
  },
  "trial": {
    "value": "7",
    "type": "day"
  },
  "grace_period": {
    "value": "2",
    "type": "day"
  },
  "external_id": "exp",
  "expiration": {
    "value": null,
    "type": "day"
  },
  "status": {
    "value": "active",
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    }
  },
  "tags": null
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"charge\":{\"amount\":20,\"currency\":\"USD\",\"period\":{\"value\":\"1\",\"type\":\"month\"}},\"name\":{\"en\":\"Experience boost\"},\"description\":{\"en\":\"3x more experience!\"},\"trial\":{\"value\":\"7\",\"type\":\"day\"},\"grace_period\":{\"value\":\"2\",\"type\":\"day\"},\"external_id\":\"exp\",\"expiration\":{\"value\":null,\"type\":\"day\"},\"status\":{\"value\":\"active\",\"counters\":{\"active\":0,\"canceled\":0,\"frozen\":0,\"non_renewing\":0}},\"tags\":null}"

response = http.request(request)
puts response.read_body
Response
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}
{
  "charge": {
    "amount": 20,
    "currency": "USD",
    "period": {
      "type": "month",
      "value": 1
    }
  },
  "description": {
    "en": "3x more experience!"
  },
  "expiration": {
    "type": "day",
    "value": 0
  },
  "external_id": "exp",
  "grace_period": {
    "type": "day",
    "value": 2
  },
  "group_id": null,
  "id": 241082,
  "localized_name": "Experience boost",
  "name": {
    "en": "Experience boost"
  },
  "project_id": 40797,
  "status": {
    "counters": {
      "active": 0,
      "canceled": 0,
      "frozen": 0,
      "non_renewing": 0
    },
    "value": "active"
  },
  "tags": [],
  "trial": {
    "type": "day",
    "value": 7
  },
  "type": "all"
}

Enable Plan

Enables a subscription plan.

HTTP REQUEST

PATCH https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Parameter Type Description
project_id
integer Project ID.
plan_id
integer Plan ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
PATCH https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "status": {
    "value": "active"
  }
}
curl --request PATCH \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"status":{"value":"active"}}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"status":{"value":"active"}}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}');
$request->setRequestMethod('PATCH');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
var request = new RestRequest(Method.PATCH);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"status\":{\"value\":\"active\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"status\":{\"value\":\"active\"}}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PATCH", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"status\":{\"value\":\"active\"}}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"status\":{\"value\":\"active\"}}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")
  .patch(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "status": {
    "value": "active"
  }
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PATCH", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Disable Plan

Disables a subscription plan.

HTTP REQUEST

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Parameter Type Description
project_id
integer Project ID.
plan_id
integer Plan ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Delete Plan

Deletes a subscription plan.

HTTP REQUEST

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete

Parameter Type Description
project_id
integer Project ID.
plan_id
integer Plan ID.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Get Plans

Lists all subscription plans.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans

Parameter Type Description
project_id
integer Project ID.
external_id
string Plan external ID (32 characters).
limit
integer Limit for the number of elements on the page.
offset
integer Number of the element from which the list is generated (the count starts from 0).
group_id
string Group ID the plans are linked to.
product_id
integer Product ID the plans are linked to.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10' \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  'limit' => '10'
)));

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?limit=10");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]
[
  {
    "charge": {
      "amount": 19.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "10x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "3b355320",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241037,
    "localized_name": "Platinum VIP",
    "name": {
      "en": "Platinum VIP",
      "fr": "Le VIP-statut platinum"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  {
    "charge": {
      "amount": 9.99,
      "currency": "USD",
      "period": {
        "type": "month",
        "value": 1
      }
    },
    "description": {
      "en": "3x more experience!"
    },
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "0fe1b6fc",
    "grace_period": {
      "type": "day",
      "value": 0
    },
    "group_id": null,
    "id": 241038,
    "localized_name": "Gold Status",
    "name": {
      "en": "Gold Status",
      "fr": "Le statut d’or"
    },
    "project_id": 40797,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  }
]

Create Product

Creates a subscription-based product.

HTTP REQUEST

POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

Parameter Type Description
project_id
integer Project ID.
name
string Product name.
group_id
string Group ID the plans are linked to.
description
string Localized item descriptions (array).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "description": [],
  "group_id": "charge",
  "name": "Channel2"
}
curl --request POST \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"description":[],"group_id":"charge","name":"Channel2"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"description":[],"group_id":"charge","name":"Channel2"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("POST", "/merchant/v2/projects/{project_id}/subscriptions/products", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"description\":[],\"group_id\":\"charge\",\"name\":\"Channel2\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "description": [],
  "group_id": "charge",
  "name": "Channel2"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}

Update Product

Updates a subscription-based product.

HTTP REQUEST

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}

Parameter Type Description
project_id
integer Project ID.
product_id
integer Product ID the plans are linked to.
name
string Product name.
group_id
string Group ID the plans are linked to.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "description": [],
  "group_id": "charge1323",
  "name": "Channel2123"
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/ \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"description":[],"group_id":"charge1323","name":"Channel2123"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"description":[],"group_id":"charge1323","name":"Channel2123"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"description\":[],\"group_id\":\"charge1323\",\"name\":\"Channel2123\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "description": [],
  "group_id": "charge1323",
  "name": "Channel2123"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}/");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}
{
  "description": [],
  "group_id": "charge13",
  "id": 1713603,
  "name": "Channel23"
}

Delete Product

Deletes a subscription-based product.

HTTP REQUEST

DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}

Parameter Type Description
project_id
integer Project ID.
product_id
integer Product ID the plans are linked to.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("DELETE", "/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}")
  .delete(null)
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response

Get Products

Lists all subscription-based products.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

Parameter Type Description
project_id
integer Project ID.
group_id
string Group ID the plans are linked to.
product_id
integer Product ID the plans are linked to.
limit
integer Limit for the number of elements on the page.
offset
integer Number of the element from which the list is generated (the count starts from 0).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/products", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]
[
  {
    "description": [],
    "group_id": "charge",
    "id": 714,
    "name": "Channel"
  },
  {
    "description": [],
    "group_id": "notify",
    "id": 715,
    "name": "notify"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 716,
    "name": "charge2"
  },
  {
    "description": [],
    "group_id": "charge",
    "id": 486,
    "name": "Channel2"
  }
]

Get Subscription

Gets a specific subscription details by ID.

HTTP REQUEST

GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}

Parameter Type Description
project_id
integer Project ID. Required.
subscription_id
integer Subscription ID. Required.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
curl --request GET \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id} \
  --header 'authorization: Basic <your_authorization_basic_key>'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

headers = { 'authorization': "Basic <your_authorization_basic_key>" }

conn.request("GET", "/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}")
  .get()
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/{subscription_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}
{
  "charge_amount": 0.03,
  "comment": "The subscription was not extended in due time\r",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": "2019-02-06T12:43:04+0300",
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 249579,
  "plan": {
    "external_id": "lowcost",
    "id": 601
  },
  "product": null,
  "status": "canceled",
  "user": {
    "id": "user1",
    "name": "John Smith"
  }
}

Update Subscription

Updates a subscription by either changing its status ('active', 'canceled', or 'non_renewing') or postponing the next billing date.

HTTP REQUEST

PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}

Parameter Type Description
project_id
integer Project ID.
subscription_id
integer Subscription ID.
user_id
string User ID.
status
string Status: active/canceled/non_renewing.
cancel_subscription_payment
boolean Setting to true will refund the last payment made for this subscription. Only works together with setting the status to canceled.
timeshift
object Billing postponement.
timeshift.type
string Billing time unit, can be ‘day’ or ‘month’.
timeshift.value
string Number of time units to postpone the billing by. The value depends on the timeshift.type parameter and can be:
  • from 1 to 366, if timeshift.type is ‘day’
  • from 1 to 12, if timeshift.type is ‘month’
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Request
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}

Headers:
  Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json

Body:
  {
  "comment": "Canceled by the user with the latest payment refund",
  "status": "active"
}
curl --request PUT \
  --url https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id} \
  --header 'authorization: Basic <your_authorization_basic_key>' \
  --header 'content-type: application/json' \
  --data '{"comment":"Canceled by the user with the latest payment refund","status":"active"}'
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"comment":"Canceled by the user with the latest payment refund","status":"active"}');

$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic <your_authorization_basic_key>',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}");
var request = new RestRequest(Method.PUT);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client

conn = http.client.HTTPSConnection("api.xsolla.com")

payload = "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}"

headers = {
    'content-type': "application/json",
    'authorization': "Basic <your_authorization_basic_key>"
    }

conn.request("PUT", "/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"comment\":\"Canceled by the user with the latest payment refund\",\"status\":\"active\"}");
Request request = new Request.Builder()
  .url("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Basic <your_authorization_basic_key>")
  .build();

Response response = client.newCall(request).execute();
var data = JSON.stringify({
  "comment": "Canceled by the user with the latest payment refund",
  "status": "active"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");

xhr.send(data);
Response
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,
        "canceled": 0,
        "frozen": 0,
        "non_renewing": 0
      },
      "value": "active"
    },
    "tags": null,
    "trial": {
      "type": "day",
      "value": 0
    },
    "type": "all"
  },
  "product": null,
  "status": "active",
  "user": {
    "id": "jb1",
    "name": "J.Black"
  }
}
{
  "charge_amount": 0.03,
  "comment": "Canceled by the user with the latest payment refund",
  "currency": "USD",
  "date_create": "2018-09-21T16:54:59+0300",
  "date_end": null,
  "date_last_charge": "2018-09-21T16:55:05+0300",
  "date_next_charge": "2018-09-21T16:55:05+0300",
  "id": 24953579,
  "plan": {
    "charge": {
      "amount": 0.03,
      "currency": "USD",
      "period": {
        "type": "day",
        "value": 1
      }
    },
    "description": null,
    "expiration": {
      "type": "day",
      "value": 0
    },
    "external_id": "lowcost",
    "grace_period": {
      "type": "day",
      "value": 2
    },
    "group_id": "newPlans",
    "id": 66001,
    "localized_name": null,
    "name": null,
    "project_id": 18404,
    "status": {
      "counters": {
        "active": 0,