商店API v2.0

概览

此部分介绍用于商店模块的方法。请使用基本认证来调用方法。要打开商店UI并启用安全支付,需先获取令牌

端点路径:https://api.xsolla.com

商店UI

打开商店

要在新窗口中打开商店UI,请使用以下链接: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 包含隐私用户数据。请确保获取该参数时使用服务器对服务器通信。

测试卡片列表

在沙盒中,您可以使用下列信用卡模拟成功的支付:

卡片 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 标准规定的 3 字母组合表示币种),值是货币金额。
default_currency
string 默认币种。
min
float 最小购买金额。
max
float 最大购买金额。
is_currency_discrete
boolean 虚拟货币是否可以使用美分。
allow_user_sum
boolean 是否允许在货币包之间支付任意金额。
amount
float 货币包中虚拟货币的金额。
sku
string 虚拟货币包的唯一 ID。
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。SKU可能仅包含小写字母、数字、破折号和下划线。
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 物品的类型:消耗品/期限品/永久品/宝箱/实物。
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 付款UI中为物品显示的特殊横幅类型。可以是'recommended'、'best_deal'、'special_offer'、'null'。
virtual_currency_price
integer 以游戏内货币计算的价格。如果为'null',则物品仅能通过真实货币购买。
purchase_limit
integer 物品可购买的次数。如果为'null',则购买次数无限制。
keywords
array 用于在付款UI中查找物品的关键字。
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。SKU可能仅包含小写字母、数字、破折号和下划线。
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 物品的类型:消耗品/期限品/永久品/宝箱/实物。
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 付款UI中为物品显示的特殊横幅类型。可以是'recommended'、'best_deal'、'special_offer'、'null'。
virtual_currency_price
integer 以游戏内货币计算的价格。如果为'null',则物品仅能通过真实货币购买。
purchase_limit
integer 物品可购买的次数。如果为'null',则购买次数无限制。
keywords
array 用于在付款UI中查找物品的关键字。
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 元素编号,从该元素开始生成列表(从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 计划描述。由"localization":"plan description"组成的键值对。 可选
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 试用期类型:day.
grace_period
object 带有宽限期相关数据的对象。 可选
grace_period.value
integer 宽限期时间量。
grace_period.type
string 试用期类型:day.
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 计划描述。由"localization":"plan description"组成的键值对。 可选
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 试用期类型:day.
grace_period
object 带有宽限期相关数据的对象。 可选
grace_period.value
integer 宽限期时间量。
grace_period.type
string 试用期类型:day.
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 元素编号,从该元素开始生成列表(从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 元素编号,从该元素开始生成列表(从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 账单推迟。
string
string 账单时间单位,可以是‘day’或‘month’。
timeshift.value
string 推迟账单的时间单位数。该值取决于timeshift.type参数:
  • 如果timeshift.type是‘day’,则可以是1-366
  • 如果timeshift.type是‘month’,则可以是1-12
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": {
      "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,</