Store API v2.0

Введение

Раздел содержит описание методов для работы с модулями продукта Магазин. Для обращения к методам используется базовая аутентификация. Для открытия интерфейса магазина и обеспечения безопасности проведения платежей необходимо получить токен.

Базовый URL: https://api.xsolla.com.

Интерфейс магазина

Открытие магазина

Для открытия интерфейса магазина используйте ссылку https://secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN, где ACCESS_TOKEN — токен, полученный по API.

Для тестирования используйте URL https://sandbox-secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN.

Notice: Параметр access_token содержит приватную информацию о пользователе. Пожалуйста, убедитесь, что вы получаете этот параметр только при server-server взаимодействии.

Список тестовых карт

В тестовом окружении вы можете использовать следующие карты для тестирования успешных платежей:

Карта 3-D Secure
Номер карты: 4111111111111111
Срок действия: 12/20
CVV2: 123
Тип карты: VISA
Нет
Номер карты: 5555555555554444
Срок действия: 11/19
CVV2: 321
Тип карты: MasterCard
Нет
Номер карты: 4000000000000010
Срок действия: 12/20
CVV2: 123
Тип карты: VISA
Да
Номер карты: 5200000000000114
Срок действия: 11/19
CVV2: 321
Тип карты: MasterCard
Да
Номер карты: 6759649826438453
Срок действия: 12/25
CVV2: 321
Тип карты: Maestro
Да

Также вы можете использовать указанный ниже список карт для тестирования отклоненных транзакций:

Карта 3-D Secure Описание
Номер карты: 4000000000000002
Срок действия: 12/20
CVV2: 123
Тип карты: VISA
Нет Недостаточно средств
Номер карты: 5200000000000007
Срок действия: 11/19
CVV2: 321
Тип карты: MasterCard
Нет Недостаточно средств
Номер карты: 4000000000000036
Срок действия: 12/20
CVV2: 123
Тип карты: VISA
Да Отклонено
Номер карты: 5200000000000031
Срок действия: 11/19
CVV2: 321
Тип карты: MasterCard
Да Отклонено

Список ошибок

Код Описание
0004-0001 Невалидный токен.
0004-0008 Интерфейс открыт по неверному URL (тестовое окружение открыто на secure.xsolla.com или боевой на sandbox-secure.xsolla.com).
0002-0004 Не заключен договор.
0004-0010 Интеграция без токена запрещена.
0010-0001 Не найден переданный пакет.
0010-0003 Не настроен DRM для пакета.
1000-0003 Нет включенных модулей у проекта.

Виртуальная валюта

Информация о пакете валюты

Информация о пакете виртуальной валюты по ID.

HTTP-ЗАПРОС

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

Параметр Type Описание
project_id
integer ID проекта.
package_id
integer ID пакета виртуальной валюты.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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
}

Изменение пакета валюты

Изменение пакета виртуальной валюты.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
package_id
integer ID пакета виртуальной валюты.
vc_name
array of strings Название продукта. Значение состоит из пар <локализация>:<название продукта>.
base
array JSON объект со стоимостью пакета в реальной валюте, валюта является ключом (Используется трехбуквенное обозначение валюты согласно стандарту ISO 4217), а значение — стоимость в данной валюте.
default_currency
string Валюта по умолчанию.
min
float Минимальная цена за пакет.
max
float Максимальная цена заказа.
is_currency_discrete
boolean Можно ли задавать дробные цены.
allow_user_sum
boolean Можно ли купить количество валюты, не соответствующее ни одному из пакетов.
amount
float Уникальный ID пакета виртуальной валюты.
sku
string Количество виртуальной валюты в пакете.
price
float Цена пакета виртуальной валюты.
image_url
string URL изображения.
description
array of strings Массив локализованных названий пакета виртуальной валюты. Значение состоит из пар <локализация>:<описание пакета>.
label
array of strings Массив локализованных надписей на лэйблах для пакета виртуальной валюты. Значение состоит из пар <локализация>:<описание пакета>.
bonus
float Скидка на пакет, %.
advertisement_type
string Тип лэйбла пакета виртуальной валюты в интерфейсе оплаты. Может принимать значения 'recommended', 'best_deal', 'special_offer' или null.
enabled
boolean Включен ли пакет виртуальной валюты.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Список пакетов валюты

Получение информации об общих настройках виртуальной валюты и списке пакетов.

HTTP-ЗАПРОС

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

Параметр Type Описание
project_id
integer ID проекта.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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"
  }
}

Виртуальные предметы

Создание предмета

Создание предмета.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
sku
string Уникальный ID предмета. Артикул может содержать только строчные латинские буквы, цифры, тире и подчеркивания.
item_code
string Дополнительный код предмета. Необязательный.
name
array of strings Массив локализованных названий предмета.
description
array of strings Массив локализованных описаний предмета.
long_description
array of strings Массив локализованных развернутых описаний предмета.
prices
array Массив цен на предмет.
default_currency
string Валюта заказа по умолчанию. Используется трехбуквенное обозначение валюты согласно стандарту ISO 4217.
enabled
boolean Включен ли предмет.
permanent
boolean Если значение 'true', то предмет можно приобрести только один раз.
image_url
string URL изображения.
item_type
string Тип предмета: Consumable/Expiration/Permanent/Lootboxes/Physical.
expiration
integer Срок действия предмета в секундах. Используется только для предметов типа 'Expiration'.
groups
array of integers Список групп предмета.
deleted
boolean Был ли предмет удален.
user_attribute_conditions
array of objects Список условий на атрибуты пользователя.
user_attribute_conditions.right_operand
array Значения для сравнения со значением атрибута пользователя.
user_attribute_conditions.user_attribute_key
string Ключ условия атрибута.
user_attribute_conditions.operation
string Тип операции. Может принимать значения 'greater', 'greaterOrEqual', 'equal', 'notEqual', 'less', 'lessOrEqual', 'between', 'in', 'notIn'.
user_attribute_conditions.action
string Тип действия. Может принимать значения 'hide', 'block' или 'warning'.
advertisement_type
string Для данного предмета появится ярлык в платежном интерфейсе. Может принимать значения 'recommended', 'best_deal', 'special_offer' или 'null'.
virtual_currency_price
integer Цена в игровой валюте. Передайте 'null', если предмет можно купить только за реальную валюту.
purchase_limit
integer Сколько раз можно приобрести данный предмет. Передайте 'null', если количество раз не ограничено.
keywords
array Ключевые слова, по которым предмет можно найти в интерфейсе оплаты.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}

Информация о предмете

Информация о предмете.

HTTP-ЗАПРОС

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

Параметр Тип Описание
item_id
integer ID предмета (артикул).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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
}

Изменение предмета

Изменение предмета.

HTTP-ЗАПРОС

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

Параметр Тип Описание
item_id
integer ID предмета (артикул).
sku
string Уникальный ID предмета. Артикул может содержать только строчные латинские буквы, цифры, тире и подчеркивания.
item_code
string Дополнительный код предмета. Необязательный.
name
array of strings Массив локализованных названий предмета.
description
array of strings Массив локализованных описаний предмета.
long_description
array of strings Массив локализованных развернутых описаний предмета.
prices
array Массив цен на предмет.
default_currency
string Валюта заказа по умолчанию. Используется трехбуквенное обозначение валюты согласно стандарту ISO 4217.
enabled
boolean Включен ли предмет.
permanent
boolean Если значение 'true', то предмет можно приобрести только один раз.
image_url
string URL изображения.
item_type
string Тип предмета: Consumable/Expiration/Permanent/Lootboxes/Physical.
expiration
integer Срок действия предмета в секундах. Используется только для предметов типа 'Expiration'.
groups
array of integers Список групп предмета.
deleted
boolean Был ли предмет удален.
user_attribute_conditions
array of objects Список условий на атрибуты пользователя.
user_attribute_conditions.right_operand
array Значения для сравнения со значением атрибута пользователя.
user_attribute_conditions.user_attribute_key
string Ключ условия атрибута.
user_attribute_conditions.operation
string Тип операции. Может принимать значения 'greater', 'greaterOrEqual', 'equal', 'notEqual', 'less', 'lessOrEqual', 'between', 'in', 'notIn'.
user_attribute_conditions.action
string Тип действия. Может принимать значения 'hide', 'block' или 'warning'.
advertisement_type
string Для данного предмета появится ярлык в платежном интерфейсе. Может принимать значения 'recommended', 'best_deal', 'special_offer' или 'null'.
virtual_currency_price
integer Цена в игровой валюте. Передайте 'null', если предмет можно купить только за реальную валюту.
purchase_limit
integer Сколько раз можно приобрести данный предмет. Передайте 'null', если количество раз не ограничено.
keywords
array Ключевые слова, по которым предмет можно найти в интерфейсе оплаты.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Удаление предмета

Удаление предмета.

HTTP-ЗАПРОС

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

Параметр Тип Описание
item_id
integer ID предмета (артикул).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Список предметов

Список предметов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
offset
integer Номер элемента, c которого выполняется вывод на странице (нумерация ведется с 0).
limit
integer Лимит количества элементов на странице.
has_price
string Тип продажи предмета. Может принимать значение 'virtual_currency' (если предмет можно купить за виртуальную валюту) или 'real_currency' (если предмет можно купить за реальную валюту).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
[
  {
    "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
  }
]

Создание группы предметов

Создание группы предметов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
name
array of strings Массив локализованных названий групп предметов.
description
array of strings Массив локализованных описаний групп предметов.
enabled
boolean Включена ли группа.
parent_id
integer ID родительской группы.
code
integer Уникальный код группы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}
{
  "group_id": 9208
}

Информация о группе предметов

Информация о группе предметов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
group_id
string ID группы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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
}

Изменение группы предметов

Изменение группы предметов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
group_id
string ID группы.
name
array of strings Массив локализованных названий групп предметов.
description
array of strings Массив локализованных описаний групп предметов.
enabled
boolean Включена ли группа.
parent_id
integer ID родительской группы.
code
integer Уникальный код группы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Удаление группы предметов

Удаление группы предметов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
group_id
string ID группы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Список групп предметов

Список всех групп предметов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
[
  {
    "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
  }
]

Атрибуты пользователей

Создание атрибута

Создание атрибута пользователя.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта. Обязательный.
key
string Ключ атрибута пользователя. Обязательный.
name
array of strings Массив локализованных названий атрибутов пользователя. Обязательный.
type
string Тип ключа. Может принимать значения 'int', 'string', 'enum' или 'date'. Обязательный.
list_of_values
array Массив возможных значений атрибута типа enum. Обязательный.
skip_condition_on_nonexistent_key
boolean Должно ли условие пропускаться, если ключа не существует.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}
{
  "id": 11427
}

Информация об атрибуте

Информация об атрибуте пользователя.

HTTP-ЗАПРОС

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

Параметр Type Описание
project_id
integer ID проекта.
user_attribute_id
integer ID атрибута.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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
}

Изменение атрибута

Изменение атрибута пользователя.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
user_attribute_id
integer ID атрибута.
key
string Ключ атрибута пользователя. Обязательный.
name
array of strings Массив локализованных названий атрибутов пользователя. Обязательный.
type
string Тип ключа. Может принимать значения 'int', 'string', 'enum' или 'date'. Обязательный.
list_of_values
array Массив возможных значений атрибута типа enum. Обязательный.
skip_condition_on_nonexistent_key
boolean Должно ли условие пропускаться, если ключа не существует.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Удаление атрибута

Удаление атрибута пользователя.

HTTP-ЗАПРОС

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

Параметр Type Описание
project_id
integer ID проекта.
user_attribute_id
integer ID атрибута.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Список атрибутов

Список атрибутов пользователя.

HTTP-ЗАПРОС

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

Параметр Type Описание
project_id
integer ID проекта.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
[
  {
    "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
  }
]

Подписки

Создание плана

Создание рекуррентного плана.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
external_id
string Внешний идентификатор плана. Необязательный.
name
array of strings Название плана. Значение состоит из пар <локализация>:<название плана>.
description
array of strings Описание плана. Значение состоит из пар <локализация>:<описание плана>. Необязательный.
group_id
string ID группы, к которой привязаны планы.
charge
object Объект с данными о рекуррентном списании.
charge.period
object Объект с данными о периоде подписки.
charge.period.value
integer Платежный цикл.
charge.period.type
string Тип платежного цикла: день / месяц.
charge.amount
float Сумма рекуррентного списания.
charge.currency
string Валюта заказа. Используется трехбуквенное обозначение валюты согласно стандарту ISO 4217.
expiration
object Объект с информацией об окончании подписки.
expiration.value
integer Время до окончания срока подписки.
expiration.type
string Тип платежного цикла: день / месяц.
trial
object Объект с данными о триальном периоде. Необязательный.
trial.value
integer Длительность триального периода.
trial.type
string Период времени: день.
grace_period
object Время периода отсрочки. Необязательный.
grace_period.value
integer Время периода отсрочки.
grace_period.type
string Период времени: день.
tags
array Теги плана. Необязательный.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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
}

Изменение параметров плана

Изменение параметров рекуррентного плана.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
plan_id
integer ID рекуррентного плана.
external_id
string Внешний идентификатор плана. Необязательный.
name
array of strings Название плана. Значение состоит из пар <локализация>:<название плана>.
description
array of strings Описание плана. Значение состоит из пар <локализация>:<описание плана>. Необязательный.
group_id
string ID группы, к которой привязаны планы.
charge
object Объект с данными о рекуррентном списании.
charge.period
object Объект с данными о периоде подписки.
charge.period.value
integer Платежный цикл.
charge.period.type
string Тип платежного цикла: день / месяц.
charge.amount
float Сумма рекуррентного списания.
charge.currency
string Валюта заказа. Используется трехбуквенное обозначение валюты согласно стандарту ISO 4217.
expiration
object Объект с информацией об окончании подписки.
expiration.value
integer Время до окончания срока подписки.
expiration.type
string Тип платежного цикла: день / месяц.
trial
object Объект с данными о триальном периоде. Необязательный.
trial.value
integer Длительность триального периода.
trial.type
string Период времени: день.
grace_period
object Время периода отсрочки. Необязательный.
grace_period.value
integer Время периода отсрочки.
grace_period.type
string Период времени: день.
tags
array Теги плана. Необязательный.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • java
  • js
  • python
  • ruby
Запрос
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
Ответ
{
  "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"
}

Включение плана

Включить рекуррентный план.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
plan_id
integer ID рекуррентного плана.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Отключение плана

Отключение рекуррентного плана.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
plan_id
integer ID рекуррентного плана.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Удаление плана

Удаление рекуррентного плана.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
plan_id
integer ID рекуррентного плана.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Список планов

Список рекуррентных планов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
external_id
string Внешний идентификатор плана.
limit
integer Лимит количества элементов на странице.
offset
integer Номер элемента, c которого выполняется вывод на странице (нумерация ведется с 0).
group_id
string ID группы, к которой привязаны планы.
product_id
integer ID продукта, к которому привязаны планы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
[
  {
    "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"
  }
]

Создание продукта

Создание продукта.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
name
string Название продукта.
group_id
string ID группы, к которой привязаны планы.
description
string Локализуемое описание группы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}
{
  "product_id": 171603
}

Изменение продукта

Изменение продукта.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
product_id
integer ID продукта, к которому привязаны планы.
name
string Название продукта.
group_id
string ID группы, к которой привязаны планы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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"
}

Удаление продукта

Удаление продукта.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
product_id
integer ID продукта, к которому привязаны планы.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ

Список продуктов

Список продуктов.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
group_id
string ID группы, к которой привязаны планы.
product_id
integer ID продукта, к которому привязаны планы.
limit
integer Лимит количества элементов на странице.
offset
integer Номер элемента, c которого выполняется вывод на странице (нумерация ведется с 0).
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
[
  {
    "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"
  }
]

Информация о подписке

Информация о конкретной подписке по ID.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта. Обязательный.
subscription_id
integer ID подписки. Обязательный.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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"
  }
}

Изменение подписки

Изменение рекуррентной подписки. Можно изменить статус подписки ('active', 'canceled' или 'non_renewing') и отложить дату следующего списания для данной подписки.

HTTP-ЗАПРОС

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

Параметр Тип Описание
project_id
integer ID проекта.
subscription_id
integer ID подписки.
user_id
string ID пользователя.
status
string Статус: active/canceled/non_renewing.
cancel_subscription_payment
boolean Если передано значение true, то происходит отмена последнего платежа, сделанного по подписке. Данный параметр работает, только если статус платежа изменен на canceled.
timeshift
object Объект с информацией об отложенном сроке следующего списания.
timeshift.type
string Период платежного цикла, принимает значения ‘day’ или ‘month’.
timeshift.value
string Время, на которое следующее списание должно быть отложено. В зависимости от параметра timeshift.type принимает следующие значения:
  • от 1 до 366 – если в timeshift.type передан ‘day’;
  • от 1 до 12 – если в timeshift.type передан ‘month’.
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
Запрос
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);
Ответ
{
  "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":