ストア API v2.0

概要

当セクションは、ストアモジュールと連動するメソッドの説明を記載しています。基本認証を使ってメソッドを呼び出します。ストア UIを開いて安全な支払いを有効にする場合は、トークンを取得してください。

エンドポイントのパス:https://api.xsolla.com

ストア UI

ストアのオープン

次のリンクを使用して、新しいウィンドウでストア UIを開く。https://secure.xsolla.com/paystation2/?access_token=ACCESS_TOKENACCESS_TOKENAPIから受信したトークン。

テストを試したいときは次のURLをご使用ください。https://sandbox-secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN

Notice: パラメーター access_token は、非公開ユーザーデータを含みます。このパラメーターを取得する際は、確実にサーバー間通信をご利用ください。

テストカード一覧

サンドボックスでは、これらのカードを使用して決済の成功をシミュレートすることができます。

カード 3D セキュア
カード番号: 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
はい

さらに、以下のデータを使用して、不承認となったトランザクションをシミュレートすることができます。

カード 3D セキュア 説明文
カード番号: 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 製品名。"language":"product name"のペアで構成されます。
base
array 主要商品通貨(オブジェクト)。キー=通貨名(ISO 4217の3文字コード)。
default_currency
string 既定の通貨。
min
float 最低購入額。
max
float 最高購入額。
is_currency_discrete
boolean 仮想通貨の10進数単位を有効にするかどうかを示します。
allow_user_sum
boolean ユーザーがパッケージに対して任意の金額を支払うことができるかどうかを示します。
int
float パッケージ内の仮想通貨の数量。
sku
string 仮想通貨パッケージの固有ID。
price
float パッケージの価格。
image_url
string 画像URL。
description
array of strings ローカライズされたパッケージ名を含む配列。"language":"package description" のペアで構成されます。
label
array of strings ローカライズされたパッケージラベル(配列)。""language":"package description" のペアで構成されます。
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 3文字コード。
enabled
boolean アイテムの有効化。
permanent
boolean 'true'の場合、アイテムは一度しか購入できません。
image_url
string 画像URL。
item_type
string アイテムのタイプ:消耗品/有効期限/恒久/ルートボックス/物品。
expiration
integer 有効期限までの時間(秒単位)。 item_type=Expirationにのみ使用されます。
groups
array of integers アイテムが属するグループ。
deleted
boolean アイテムが削除されたかどうかを示します。
user_attribute_conditions
array of objects ユーザー属性に関する条件の一覧。
user_attribute_conditions.right_operand
array ユーザー属性と比較する値。
user_attribute_conditions.user_attribute_key
string ユーザー属性条件のキー。
user_attribute_conditions.operation
string 操作の種類。'greater'、'greaterOrEqual'、'equal'、'notEqual'、'less'、'lessOrEqual'、'between'、'in'、または'notIn'に指定できます。
user_attribute_conditions.action
string アクションの種類。'hide'、'block'、または'warning'に指定できます。
advertisement_type
string 決済インターフェースのアイテムに表示する特別なバナーの種類。'recommended'、'best_deal'、'special_offer'、またはnullに指定できます。
virtual_currency_price
integer ゲーム内通貨での価格。'null'の場合、現金通貨でのみアイテムを購入できます。
purchase_limit
integer アイテムを購入できる回数。'null'の場合、購入できる回数に制限はありません。
keywords
array 決済インターフェースでアイテムを検索するために使用できるキーワード。
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
リクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

xhr.send(data);
レスポンス
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}
{
  "item_id": 163099
}

仮想アイテムの取得

仮想アイテムを取得します。

HTTPリクエスト

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

パラメータ 種類 説明文
item_id
integer アイテムID。
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
リクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

アイテムの更新

仮想アイテムを更新します。

HTTPリクエスト

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

パラメータ 種類 説明文
item_id
integer アイテムID。
sku
string 固有アイテムID。SKUには、英小文字、ダッシュ、およびアンダースコアのみが含まれます。
item_code
string 追加のアイテムコード。 任意。
name
array of strings ローカライズされたアイテム名(配列)。
description
array of strings ローカライズされたアイテムの説明文(配列)。
long_description
array of strings アイテム(配列)のローカライズされた詳細な説明文。
prices
array アイテム価格(配列)。
default_currency
string 既定の通貨。ISO 4217 3文字コード。
enabled
boolean アイテムの有効化。
permanent
boolean 'true'の場合、アイテムは一度しか購入できません。
image_url
string 画像URL。
item_type
string アイテムのタイプ:消耗品/有効期限/恒久/ルートボックス/物品。
expiration
integer 有効期限までの時間(秒単位)。 item_type=Expirationにのみ使用されます。
groups
array of integers アイテムが属するグループ。
deleted
boolean アイテムが削除されたかどうかを示します。
user_attribute_conditions
array of objects ユーザー属性に関する条件の一覧。
user_attribute_conditions.right_operand
array ユーザー属性と比較する値。
user_attribute_conditions.user_attribute_key
string ユーザー属性条件のキー。
user_attribute_conditions.operation
string 操作の種類。'greater'、'greaterOrEqual'、'equal'、'notEqual'、'less'、'lessOrEqual'、'between'、'in'、または'notIn'に指定できます。
user_attribute_conditions.action
string アクションの種類。'hide'、'block'、または'warning'に指定できます。
advertisement_type
string 決済インターフェースのアイテムに表示する特別なバナーの種類。'recommended'、'best_deal'、'special_offer'、またはnullに指定できます。
virtual_currency_price
integer ゲーム内通貨での価格。'null'の場合、現金通貨でのみアイテムを購入できます。
purchase_limit
integer アイテムを購入できる回数。'null'の場合、購入できる回数に制限はありません。
keywords
array 決済インターフェースでアイテムを検索するために使用できるキーワード。
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
リクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}virtual_items/items/{item_id}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

xhr.send(data);
レスポンス

アイテムの削除

仮想アイテムを削除します。

HTTPリクエスト

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

パラメータ 種類 説明文
item_id
integer アイテムID。
Copy
Full screen
http
  • http
  • curl
  • php
  • C#
  • python
  • ruby
  • java
  • js
リクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

xhr.send(data);
レスポンス

アイテム一覧の取得

仮想アイテムを一覧表示します。

HTTPリクエスト

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

パラメータ 種類 説明文
project_id
integer プロジェクトID。
offset
integer リスト生成元のエレメントの番号です(カウントは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 type=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 type=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 プラン外部ID(32文字)。 任意。
name
array of strings プラン名。"language":"caption"のペアで構成されます。
description
array of strings プランの説明文。language":"plan description"のペアで構成されます。 任意。
group_id
string プランがリンクされているグループのID。
charge
object 請求の詳細(オブジェクト)。
charge.period
object 請求期間(オブジェクト)。
charge.period.value
integer 時間単位の数。
charge.period.type
string 時間単位: day / month。
charge.amount
float 請求額。
charge.currency
string 購入通貨。ISO 4217 に準拠した3文字の通貨コード。
expiration
object サブスクリプションの有効期限の詳細(オブジェクト)。
expiration.value
integer 有効期間。
expiration.type
string 時間単位: day / month。
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 プラン外部ID(32文字)。 任意。
name
array of strings プラン名。"language":"caption"のペアで構成されます。
description
array of strings プランの説明文。language":"plan description"のペアで構成されます。 任意。
group_id
string プランがリンクされているグループのID。
charge
object 請求の詳細(オブジェクト)。
charge.period
object 請求期間(オブジェクト)。
charge.period.value
integer 時間単位の数。
charge.period.type
string 時間単位: day / month。
charge.amount
float 請求額。
charge.currency
string 購入通貨。ISO 4217 に準拠した3文字の通貨コード。
expiration
object サブスクリプションの有効期限の詳細(オブジェクト)。
expiration.value
integer 有効期間。
expiration.type
string 時間単位: day / month。
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 プラン外部ID(32文字)。
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 請求の延期。
timeshift.type
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":