エンドポイントのパス
Xsolla APIエンドポイントはhttps://api.xsolla.com
にあります。たとえば、List Projectsエンドポイントのフルパスは https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/projects
です。
ほとんどのエンドポイントのパスには、merchant_idパラメーターが含まれています。これは、アプリケーションが出品者のために機能していることを示します。
Xsolla Login APIエンドポイントはhttps://login.xsolla.com
にあります。
##リクエストとレスポンス
Xsolla APIエンドポイントへのリクエストには、次のHTTPヘッダーが含まれている必要があります。Authorization, Accept
POSTリクエストとPUTリクエストには、ヘッダーがもう一つ必要です。 コンテンツタイプ:application / json
既定では、すべてのエンドポイントレスポンスはレスポンス本体にJSONデータを持ち、 コンテンツタイプ:application / json
ヘッダーを含みます。
API エンドポイント
https://api.xsolla.com
https://api.xsolla.com
https://api.xsolla.com
###ヘッダー
Authorization: Basic AUTHORIZATION_BASE64_ENCODED_STRING
Accept: application/json
コンテンツタイプ:application / json
Authorization: Basic AUTHORIZATION_BASE64_ENCODED_STRING
Accept: application/json
コンテンツタイプ:application / json
Authorization: Basic AUTHORIZATION_BASE64_ENCODED_STRING
Accept: application/json
コンテンツタイプ:application / json
APIの変更点
XsollaはAPIの機能を次のように変更することがあります:
新しいAPIリソースを追加する。
オプションのリクエストパラメータを追加する。
既存のAPIレスポンスに新しいプロパティを追加する。
列挙可能な値の既存のパラメータに新しい値を追加する。
新しいウェブフックタイプとJSONパラメータを追加する。
HTTPリクエストヘッダを追加する。
有効なパラメータに無効な値が含まれているリクエストを拒否する。
解析ロジックが変更された場合、寛大な構文解析のために以前に受け入れられた不適切な形式のリクエストを拒否する。 文書化されていない機能をいつでも追加、変更、削除することができる。
変更に関係なく、クライアントは機能し続けます。たとえば、クライアントによって認識されない新しいJSONパラメータは、通常の操作を妨げてはいけません。
##バージョン管理
すべてのXsolla APIメソッドはバージョン管理をサポートしています。現在のバージョンと互換性のない変更があるたびに新しいバージョンを発行します。バージョンは、URLの"/merchant"接頭辞に続く"v1"や"v2"などの識別子によって識別されます。
初めてAPIを使用する場合は、最新のバージョンを使用してください。 バージョンを省略すると、デフォルトで最初のバージョンが使用されます。 Googleでは、同じバージョン内でのみAPIの完全性を保証することができます。
認証
XsollaはHTTP基本認証を使用します。 マーチャント IDを基本認証ユーザー名として、APIキー(Xsolla Publisherアカウント> [設定]を参照)をパスワードとして入力します。
すべてのAPIリクエストはHTTPS 経由で送信されなければなりません。HTTP経由のリクエストは機能しません。
各リクエストには必ず認証の詳細を含めるようにしてください。
APIを使用するには、必ずTLS 1.2以上を使用してください。
###例
<?php
use Xsolla\SDK\API\XsollaClient;
$xsollaClient = XsollaClient::factory(array(
'merchant_id' => MERCHANT_ID,
'api_key' => API_KEY
));
GET /merchant/v2/merchants/{merchant_id}/events/messages HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/events/messages' \
-X GET \
-u merchant_id:merchant_api_key
エンドポイントの種類
エンドポイントのタイプは、どのような種類のデータを処理するのか、どのような処理を実行するのかを示します。 最も一般的なアクションは次のとおりです。
アクション | HTTPメソッド | 説明 |
---|---|---|
作成 | POST | 指定されたタイプのエンティティを作成して保存します。 |
リスト | GET | クエリに一致するエンティティのリストを返します。エンティティの詳細を取得するには、最初に対応するリストのエンドポイントを使用してそのIDを見つけ、このIDを対応する取得のエンドポイントに提供します。 |
取得 | GET | 指定されたIDを持つエンティティの詳細を提供します。 |
置換 | PUT | 指定されたIDを持つエンティティのすべてのフィールドを変更します。 |
更新 | PATCH | 指定されたIDを持つエンティティの指定されたフィールドを変更します。 |
削除 | DELETE | 指定されたIDを持つエンティティを削除します。 |
ページネーション
リストのエンドポイントは、返された結果にページ区切りを付けることがあります。つまり、すべての結果を単一のレスポンスで返す代わりに、 これらのエンドポイントは結果の一部と、次の結果セットにリンクするレスポンスヘッダを返す可能性が あります。この目的のために、オフセットとリミットのパラメータを使用します。
次の結果セットを取得するために、次のURLにフォローアップのリクエスト(すべての通常のヘッダーを含む)を送信します。後続のURLなしで レスポンスを受け取るまで、繰り返してください。
エラー処理
Xsollaは、従来のHTTP レスポンスコードを使用して、APIリクエストが成功したかどうかを示します。一般的に、 2xxは成功を示し、4xxは提供された情報のエラー(例えば、 必要なパラメータの欠落、認証の失敗など)を示し、5xxはXsollaのサーバに関する問題を 示します。
しかし、すべてのエラーがHTTPレスポンスコードと完全に一致するわけではありません。たとえば、リクエストが有効であったにもかかわらず失敗した場合、APIは 「422」エラーコードを返します。
すべてのAPIエラーレスポンスは、JSONオブジェクトに次のフィールドを提供します。
名前 | 種類 | 説明 |
---|---|---|
http_status_code | int | HTTPコード。 |
message | string | 人間が判読できるエラーの説明。このメッセージは常に英語で表示されます。将来的に変更される可能性があるため、特定のエラーのためにこの値に頼らないでください。 |
extended_message | string | より詳細なエラーの説明。 |
request_id | string | トラブルシューティングに使用する固有のリクエストID。 |
###サポートされているHTTPエラーの一覧:
- 200、201、204 — エラーはありません。
- 400 Bad Request — これは必要なパラメーターが欠落していることを示します。詳細については、レスポンス本文を参照してください。
- 401 Unauthorized — 有効なAPIキーがありません。
- 402 Request Failed — パラメータは有効でしたがリクエストの実行に失敗しました。
- 403 Forbidden — 許可されていません。詳細については、レスポンス本文を参照してください。
- 404 Not Found — 要求された項目が見つかりません。
- 409、422 — リクエストパラメータが無効です。
- 412 Precondition Failed — プロジェクトはまだアクティブ化されていません(Get Tokenメソッドで使用されています)。
- 415 Unsupported Media Type — HTTPヘッダに "Content-Type:application / json"がありません。
- 500, 502, 503, 504 Server Errors — サーバーエラーが起きました。.
###エラーレスポンスの例:
- {
- "http_status_code":500,
- "message":"Internal Server Error",
- "extended_message": null,
- "request_id":"6445b85"
- }
トークン
決済をより安全に行うために、Xsolla Payment APIは、決済ページで直接HTTP GETリクエストを使用してデータを受け取る代わりに、 決済パラメータの一覧を含むトークンを使用します。決済ページを呼び出す前に、新しいトークンを取得する必要があります。 トークンの有効期間は24時間です。
Xsollaは任意のユーザーパラメータでトークンを作成しますこれらのパラメータを送信すると、決済後に当社がこれらのパラメータを 受信します。トークンにはすべてのユーザーパラメータが含まれます。
パラメータ | 種類 | 説明 |
---|---|---|
user | object | ユーザーの詳細(オブジェクト)。 |
user.id | object | ユーザーID。 必須。 |
user.id.value | string | ユーザーID |
user.id.hidden | boolean | この要素を決済インターフェースで非示にできるかどうかを示します。既定では 'True'です。 |
user.id.allow_modify | boolean | ユーザーが決済インターフェースでアイテムを変更できるかどうかを示します。既定では'False'です。 |
user.name | object | ユーザーのニックネームに関するデータを含むオブジェクト。 |
user.name.value | string | ユーザーのスクリーン名。 |
user.name.hidden | boolean | この要素を決済インターフェースで非示にできるかどうかを示します。既定では 'True'です。 |
user.name.allow_modify | boolean | ユーザーが決済インターフェースでアイテムを変更できるかどうかを示します。既定では'False'です。 |
user.email | object | ユーザーのEメール(オブジェクト)。 |
user.email.value | string | ユーザーのEメール。 |
user.email.hidden | boolean | この要素を決済インターフェースで非示にできるかどうかを示します。既定では 'True'です。 |
user.email.allow_modify | boolean | ユーザーが決済インターフェースでアイテムを変更できるかどうかを示します。既定では'False'です。 |
user.phone | object | ユーザーの電話番号(オブジェクト)。 |
user.phone.value | string | ユーザーの電話番号。 |
user.phone.hidden | boolean | この要素を決済インターフェースで非示にできるかどうかを示します。既定では 'True'です。 |
user.phone.allow_modify | boolean | ユーザーが決済インターフェースでアイテムを変更できるかどうかを示します。既定では'False'です。 |
user.country | object | ユーザーの国(オブジェクト)。 |
user.country.value | string | ユーザーの国。2文字の国コード(大文字)は、ISO 3166-1 alpha-2 standardに従って使用されます。 |
user.country.allow_modify | boolean | ユーザーが決済インターフェースで国を変更できるかどうか示します。既定では「False」です。 |
user.attributes | object | キー値ペアの有効なJSONセットとして表される、アイテムリストをフィルタリングするためのユーザー属性。 |
user.steam_id | object | ユーザーのSteam ID(オブジェクト)。 |
user.steam_id.value | string | Steam ID。 |
user.tracking_id | object | ユーザー追跡ID(オブジェクト)。 |
user.tracking_id.value | string | 固有の追跡ID(マーケティングキャンペーンで使用)。 |
user.public_id.value | string | ユーザーを一意に識別し、ユーザーに知られているパラメーター(電子メール、スクリーン名など)。ユーザーがゲームストア外で購入することを可能にします(例えば、電子キオスクを介して)。 |
user.utm | object | トラフィック属性(オブジェクト)。 |
user.utm.utm_source | string | トラフィックソース。 |
user.utm.utm_medium | string | トラフィックチャネル(コンテンツ広告、メディア広告、Eメールリストなど)。 |
user.utm.utm_campaign | string | カタカナ表記、または英語に翻訳されたキャンペーンのタイトル。 |
user.utm.utm_term | string | キャンペーンキーワード。設定すると、統計は特定の検索クエリではなく広告ターゲティングに使用されるキーワードに基づきます。Googleアナリティクスでは、指定されたutm_termは一般検索語句レポートの一部です。 |
user.utm.utm_content | string | キャンペーンのコンテンツ。 |
settings | object | カスタムプロジェクト設定(オブジェクト)。 |
settings.external_id | string | トランザクションの外部ID。 |
settings.project_id | int | ゲームのXsolla ID。パブリッシャ―アカウントにあります。 必須。 |
settings.language | string | インタフェース言語。 ISO 639-1の2文字の小文字の言語コード。 |
settings.return_url | string | ページを使用して決済後にユーザーをリダイレクトします。パラメーター"user_id"、"foreinginvoice"、"invoice_id"と"status"は、自動的にリンクに追加されます。 |
settings.currency | string | 標準の決済通貨。ISO 4217 3文字通貨コード。 |
settings.mode | string | 決済処理をテストするには、"sandbox"に設定します。この場合、https://sandbox-secure.xsolla.comを使用してテスト決済インターフェースにアクセスしてください。 |
settings.payment_method | int | 決済方法のID。 |
settings.payment_widget | string | 支払いウィジェットです。paybycashまたはgiftcardが選択できます。このパラメータが設定されている場合、ユーザーはPay by CashまたはGift Cardsウィジェットにそれぞれリダイレクトされます。 |
settings.ui | object | インタフェース設定(オブジェクト)。 |
settings.ui.theme | string | 決済インターフェースのテーマ。'default'(既定)または 'dark'に指定できます。 |
settings.ui.size | string | 決済インターフェースのサイズ。
|
settings.ui.version | string | デバイスの種類。'desktop'(既定)または'mobile'に指定できます。 |
settings.ui.desktop | object | デスクトップバージョン(オブジェクト)のインターフェース設定。 |
settings.ui.desktop.header | object | ヘッダー設定(オブジェクト)。 |
settings.ui.desktop.header.is_visible | boolean | 決済インターフェースにヘッダーを表示するかどうかを示します。 |
settings.ui.desktop.header.visible_logo | boolean | trueの場合は、ヘッダーにロゴが表示されます(まず、アカウントマネージャーに画像を提供してください)。 |
settings.ui.desktop.header.visible_name | boolean | ヘッダーにプロジェクト名を表示するかどうかを示します。 |
settings.ui.desktop.header.type | string | ヘッダーを表示する方法。'compact'(プロジェクト名とユーザーIDを隠す)または 'normal'(既定)に指定できます。 |
settings.ui.desktop.subscription_list | object | サブスクリプションプラン(オブジェクト)の一覧の設定。 |
settings.ui.desktop.subscription_list.layout | string | テンプレートの一覧。'list'(既定)または 'grid'に指定できます。 |
settings.ui.desktop.subscription_list.description | string | 決済インターフェースの利用可能なサブスクリプションプランの一覧上に表示されるテキスト。 |
settings.ui.desktop.subscription_list.display_local_price | boolean | trueの場合、ユーザーの現地通貨が購読プランに設定されている通貨と異なる場合、ユーザーは両方の価格を見ることができます。1つは現地通貨で、もう1つは基本通貨で表示されます。 |
settings.ui.desktop.virtual_item_list | object | 仮想アイテム(オブジェクト)の一覧の設定。 |
settings.ui.desktop.virtual_item_list.layout | string | テンプレートの一覧。'list'(既定)または 'grid'に指定できます。 |
settings.ui.desktop.virtual_item_list.button_with_price | boolean | trueの場合は、価格がボタンに表示されます。falseの場合は、価格はボタンの左側に表示されます。既定ではFalseです。 |
settings.ui.desktop.virtual_items_list.view | string | 縦方向または横方向のメニューに仮想アイテムのグループを表示しましょう。'horizontal_navigation'あるいは'vertical' (既定) にできます。 |
settings.ui.desktop.virtual_currency_list | object | 仮想通貨(オブジェクト)の一覧の設定。 |
settings.ui.desktop.virtual_currency_list.description | string | 決済インターフェースの一覧の上に表示するテキスト。 |
settings.ui.desktop.virtual_currency_list.button_with_price | boolean | trueの場合は、価格がボタンに表示されます。falseの場合は、価格はボタンの左側に表示されます。既定ではFalseです。 |
settings.ui.header.visible_virtual_currency_balance | boolean | この要素を決済インターフェースで非示にできるかどうかを示します。既定では ‘True’です。 |
settings.ui.mobile.mode | string | ユーザーは、保存された決済方法を使用してのみ決済を行うことができます。'saved_accounts'に指定できます。 |
settings.ui.mobile.header.close_button | boolean | プッシュボタンを表示するかどうかを指定するには、決済インタフェースを閉じ、ユーザーは'settings.return_url'パラメーターで指定されたURL(既定ではFalse)にリダイレクトされます。 |
settings.ui.mobile.footer.is_visible | boolean | モバイル版の決済インターフェースでフッターを非表示にするかどうかを示します。 |
settings.ui.license_url | string | EULAへのリンク。 |
settings.ui.components | object | メニュー設定(オブジェクト)。 |
settings.ui.components.virtual_items | object | 仮想アイテムサブメニュー。 |
settings.ui.components.virtual_items.order | int | メニュー内のサブメニューの位置。 |
settings.ui.components.virtual_items.hidden | boolean | サブメニューを表示するかどうかを示します。 |
settings.ui.components.virtual_items.selected_group | string | 仮想アイテムタブを開いた後に表示するグループ。 |
settings.ui.components.virtual_items.selected_item | string | 仮想アイテムタブを開いた後に表示されるアイテム(アイテムSKU)。 |
settings.ui.components.virtual_currency | object | 仮想通貨サブメニュー。 |
settings.ui.components.virtual_currency.custom_amount | boolean | ユーザーが任意の数の仮想通貨を決済インターフェースに入力できるかどうかを示します。 |
settings.ui.components.virtual_currency.order | int | メニュー内のサブメニューの位置。 |
settings.ui.components.virtual_currency.hidden | boolean | サブメニューを表示するかどうかを示します。 |
settings.ui.components.subscriptions | object | サブスクリプションプランのサブメニュー(オブジェクト)。 |
settings.ui.components.subscriptions.order | int | メニュー内のサブメニューの位置。 |
settings.ui.components.subscriptions.hidden | boolean | サブメニューを表示するかどうかを示します。 |
settings.ui.mode | string | ユーザーアカウントの決済インターフェース。'user_account'のみに指定できます:ヘッダーにはユーザーアカウントのナビゲーションメニューのみが含まれています。ユーザーは商品を選択したり、決済を行うことはできません。このモードは、デスクトップ上でのみ使用できます。 |
settings.ui.user_account | オブジェクト | ユーザーアカウントの詳細(オブジェクト)。 |
settings.ui.user_account.info | object | 「マイアカウント」ページ。 |
settings.ui.user_account.info.order | int | メニュー内のサブメニューの位置。 |
settings.ui.user_account.info.enable | boolean | サブメニューを表示するかどうかを示します。既定では'False'です。 |
settings.ui.user_account.history | object | 履歴サブメニュー。 |
settings.ui.user_account.history.order | int | メニュー内のサブメニューの位置。 |
settings.ui.user_account.history.enable | boolean | サブメニューを表示するかどうかを示します。既定では'False'です。 |
settings.ui.user_account.payment_accounts | object | 「決済アカウント」サブメニュー。 |
settings.ui.user_account.payment_accounts.order | int | メニュー内のサブメニューの位置。 |
settings.ui.user_account.payment_accounts.enable | boolean | サブメニューを表示するかどうかを示します。既定では'False'です。 |
settings.ui.user_account.subscriptions | object | 「サブスクリプションの管理」サブメニュー。 |
settings.ui.user_account.subscriptions.order | int | メニュー内のサブメニューの位置。 |
settings.ui.user_account.subscriptions.enable | boolean | サブメニューを表示するかどうかを示します。既定では'False'です。 |
settings.shipping_enabled | boolean | 配送先住所の入力フォームの表示/非表示を切替。デフォルトは'False'。 |
purchase | object | 購入の詳細を含むオブジェクト。 |
purchase.virtual_currency | object | 仮想通貨の詳細を含むオブジェクト。 |
purchase.virtual_currency.quantity | float | 仮想通貨での購入金額。 |
purchase.virtual_currency.currency | string | すべての計算で使用する仮想通貨パッケージの通貨。 |
purchase.virtual_items | object | 購入時の仮想アイテムに関するデータを持つオブジェクト。 |
purchase.virtual_items.currency | string | すべての計算で使用する注文アイテムの通貨。 |
purchase.virtual_items.items | array | アイテムデータ(配列)。 |
purchase.virtual_items.items.sku | string | アイテムID。 |
purchase.virtual_items.items.amount | int | アイテム数量。 |
purchase.virtual_items.available_groups | array | アイテムグループのID(配列)。決済インターフェースには、指定したグループ内のアイテムのみが含まれます。 |
purchase.subscription | object | サブスクリプションデータ(オブジェクト)。 |
purchase.subscription.plan_id | string | プランID。 |
purchase.subscription.product_id | string | 製品ID。 |
purchase.subscription.currency | string | すべての計算で使用するサブスクリプションプランの通貨。 |
purchase.subscription.available_plans | string | 決済インターフェイスに表示するサブスクリプションプラン(配列)。 |
purchase.subscription.trial_days | int | 数日ぶりのトライアル期間。サブスクリプションを申し込んだ時と、トライアル期間が決められていないプランにのみ使われる。 |
purchase.pin_codes | object | PINコード(オブジェクト)。 |
purchase.pin_codes.currency | string | すべての計算で使用する注文内のPINコードの通貨。 |
purchase.pin_codes.codes | array | PINコード(配列)。 |
purchase.pin_codes.codes.digital_content | string | サイト運営者アカウントに設定されたゲームのSKU。 |
purchase.pin_codes.codes.drm | string | ゲームを配布するために使用されるDRMプラットフォーム。'steam'、'playstation'、'xbox'、'uplay'、'origin'、'drmfree'のいずれかに指定できます。サイト運営者アカウントに必要なDRMを設定していることを確認してください。トークンに渡されなかった場合は、決済インターフェースでユーザーが選択します。 |
purchase.checkout | object | チェックアウトの詳細(オブジェクト)。 |
purchase.checkout.currency | string | 購入通貨。ISO 4217 3文字通貨コード。 |
purchase.checkout.amount | float | 購入金額。 |
purchase.description | object | 購入の説明(オブジェクト)。 |
purchase.description.value | string | UIとEメールの受信に含める購入の説明。 |
purchase.gift | object | 贈り物に関するデータを含むオブジェクト。 |
purchase.gift.giver_id | string | 贈り主のID。 |
purchase.gift.message | string | 贈り主からのメッセージ。 |
purchase.gift.hide_giver_from_receiver | string | 贈り主の情報を受取り側に公開するかどうか('true'がデフォルトです) |
purchase.gift.friends | array | フレンドのデータを配列。 |
purchase.gift.friends.id | string | ID。 |
purchase.gift.friends.name | string | ニックネーム。 |
purchase.gift.friends.email | string | 贈り物を受け取る人のメールアドレス。 |
custom_parameters | object | カスタムパラメータ、アイテムリストをフィルタリングするためのユーザー属性。 |
いずれかのパラメータが間違った形式で送信されたか、タイプが間違っている場合、トークンは発行されません。JSON本体にエラー記述とともに422 HTTPコードが送られます。この'extended_message'は、どのパラメータが間違っていたかを示します。 { "extended_message":{ "global_errors":[], "property_errors":{ "settings.project_id":[ "string value found, but an integer is required" ] } } }
リクエスト
<?php
use Xsolla\SDK\API\XsollaClient;
use Xsolla\SDK\API\PaymentUI\TokenRequest;
$tokenRequest = new TokenRequest($projectId, $userId);
$tokenRequest->setUserEmail('email@example.com')
->setExternalPaymentId('12345')
->setSandboxMode(true)
->setUserName('USER_NAME')
->setCustomParameters(array('key1' => 'value1', 'key2' => 'value2'));
$xsollaClient = XsollaClient::factory(array(
'merchant_id' => MERCHANT_ID,
'api_key' => API_KEY
));
$token = $xsollaClient->createPaymentUITokenFromRequest($tokenRequest);
POST /merchant/v2/merchants/{merchant_id}/token HTTP/1.1
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"user": {
"id": {
"value": "1234567",
"hidden": true
},
"email": {
"value": "email@example.com",
"allow_modify": true,
"hidden": false
},
"country": {
"value": "US"
}
},
"settings": {
"project_id": 14004,
"language":"en",
"currency":"USD",
"ui": {
"size":"medium"
}
},
"purchase": {
"virtual_currency": {
"quantity": 100
},
"virtual_items": {
"items": [{
"sku":"SKU01",
"amount":1
}]
},
"description": {
"value": "Test Purchase"
}
},
"custom_parameters": {
"parameter1": "value1"
}
}
$ curl -v 'https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"user": {
"id": {
"value": "1234567",
"hidden": true
},
"email": {
"value": "email@example.com",
"allow_modify": true,
"hidden": false
},
"country": {
"value": "US"
}
},
"settings": {
"project_id": 14004,
"language":"en",
"currency":"USD",
"ui": {
"size":"medium"
}
},
"purchase": {
"virtual_currency": {
"quantity": 100
},
"virtual_items": {
"items": [{
"sku":"SKU01",
"amount":1
}]
},
"description": {
"value": "Test Purchase"
}
},
"custom_parameters": {
"parameter1": "value1"
}
}'
レスポンス
<?php
// example response
$token = 'uV0iCEvWkUGVqWerTgbrndWePOMiLAfO';
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"token": "uV0iCEvWkUGVqWerTgbrndWePOMiLAfO"
}
{
"token": "uV0iCEvWkUGVqWerTgbrndWePOMiLAfO"
}
追加パラメータの一覧表示
不正防止フィルタを設定するために、トークンに追加パラメータを渡すことができます。推奨のパラメータを以下の表に示します。必要に応じて一覧を全文表示することができます。
名前 | 種類 | 説明文 |
---|---|---|
registration_date | string | ISO 8601形式のアカウント作成日 |
total_hours | int | 合計ゲーム時間数。 |
total_characters | int | ゲーム内のキャラクターの数。 |
social_networks_added | boolean | プレイヤーがソーシャルメディアプロファイルを接続しているかを示します。 |
profile_image_added | boolean | プレイヤーがプロフィール画像をアップロードしたかどうかを示します。 |
last_active_date | string | ISO 8601形式の最終閲覧日。 |
total_friends | int | 友達の数。 |
additional_verification | boolean | プレイヤーがアカウント承認手続きを使用するかどうかを示します。 |
win_rate | int | 勝率。 |
last_change_password_date | string | ISO 8601に沿ったパスワード最終更新日。 |
chat_activity | boolean | プレイヤーがチャット機能を使用するかどうかを示します。 |
forum_activity | boolean | プレイヤーがプロフィール画像をアップロードしたかどうかを示します。 |
total_bans | int | チャットやフォーラムでプレイヤーが禁止された回数。 |
profile_completed | boolean | プレイヤーがプロフィールに追加情報を入力したかどうかを示します。 |
notifications_enabled | boolean | プレイヤーが通知を有効化したかどうかを示します。 |
user_level | int | プレイヤーのレベル、評判、またはランク。 |
karma_points | int | プレイヤーのカルマ値。 |
total_sum | float | 総支払額。 |
non_premium_currency | float | 非プレミアム通貨の金額。 |
total_game_events | int | プレイヤーが参加したゲーム内イベントの数。 |
total_gifts | int | プレイヤーが送受信したゲーム内の贈り物の数。 |
tutorial_completed | boolean | プレイヤーがゲームのチュートリアルを完了したかどうかを示します。 |
completed_tasks | int | 完了したタスクや目標の数。 |
items_used | boolean | プレイヤーが購入したゲームアイテムを使用するかどうかを示します。 |
pvp_activity | boolean | プレイヤーが対人戦に参加するかどうかを示します。 |
total_clans | int | プレイヤーがメンバーになっているクランの数。 |
unlocked_achievements | int | 達成した実績の数。 |
total_inventory_value | float | インベントリ総額(ゲーム内通貨)。 |
character_customized | boolean | プレイヤーがキャラクターをカスタマイズしたかどうかを示します。 |
session_time | string | ISO 8601に沿った平均セッション時間。 |
Pay Station UI
Pay Stationは、ユーザーがウェブサイト上でゲームやアイテムを購入できる決済インターフェースです。簡単にウェブサイトに決済インターフェースを実装するには、当社のCDN linkから次のスクリプトをダウンロードしてください。このURLを使用して、Webサイトにスクリプトを統合してください。 詳細は、GitHubリポジトリを参照してください。
スクリプト初期化パラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
access_token | string | APIから受信したPay Stationトークン。 必須。 |
sandbox | boolean | 決済処理をテストするには、trueに設定します.sambox-secure.xsolla.comがsecure.xsolla.comの代わりに使用されます。 |
lightbox | object | ライトボックスパラメータ(オブジェクト、デスクトップバージョンのみ)。 |
lightbox.width | string | ライトボックスのフレーム幅。nullの場合、Pay Stationの幅に依存します。既定はnullです。 |
lightbox.height | string | ライトボックスのフレームの高さ。nullの場合、Pay Stationの高さに依存します。既定は'100%'です。 |
lightbox.zIndex | int | 配置順序を定義します。既定は1000です。 |
lightbox.overlayOpacity | int | オーバーレイ不透明度(0〜1)。既定は '.6'です。 |
lightbox.overlayBackground | string | オーバーレイの背景色。既定は '#000000'です。 |
lightbox.modal | boolean | Trueの場合、ライトボックスフレームを閉じることはできません。既定は 'false'です。 |
lightbox.closeByClick | boolean | Trueの場合、オーバーレイをクリックするとライトボックスが閉じます。既定は 'true'です。 |
lightbox.closeByKeyboard | boolean | Trueの場合、ESCを押すとライトボックスが閉じます。既定は 'true'です。 |
lightbox.contentBackground | string | フレームの背景色。既定は '#ffffff'です。 |
lightbox.contentMargin | string | フレームマージン。既定は'10px'です。 |
lightbox.spinner | string | ローディングアニメーションのインジケータの種類。'xsolla'または 'round'に指定できます。既定は 'xsolla'です。 |
lightbox.spinnerColor | string | スピナーの色。既定値はありません。 |
childWindow | object | Pay Station UIを含む子ウィンドウのオプション。モバイル版でサポートされています。 |
childWindow.target | string | Pay Stationウィンドウを開く場所。'_blank'、'_self'、'_parent'に指定できます。既定は '_blank'です。 |
このスクリプトでは、決済インターフェースのイベントを追跡することができます。イベントの種類に応じて、Webページでさまざまな操作を実行できます。
イベントの一覧:
パラメータ | 説明 |
---|---|
init | ウィジェットが初期化されました。 |
open | ウィジェットが開かれました。 |
load | 決済インターフェース(Pay Station)が読み込まれました。 |
close | 決済インターフェース(Pay Station)が閉じられています。 |
status | ユーザーはステータスページにいます。 |
status-invoice | ユーザーはステータスページにいます。支払いが進行中です。 |
status-delivering | ユーザーはステータスページにいます。支払いが完了しました。支払い通知が送信されました。 |
status-done | ユーザーはステータスページにいます。支払いはユーザーのアカウントに振り込まれます。 |
status-troubled | ユーザーはステータスページにいます。支払いに失敗しました。 |
ご自身で決済インターフェースの開始を初期化する場合は、次のリンクを使用してください:https://secure.xsolla.com/paystation2/?access_token=ACCESS_TOKEN
、ここでACCESS_TOKEN
は前の手順。
例:コールバックを使用した非同期スクリプトの読み込み。
<html>
<head lang="en">
<meta charset="UTF-8">
</head>
<body>
<button data-xpaystation-widget-open>Buy Credits</button>
<?php \Xsolla\SDK\API\PaymentUI\PaymentUIScriptRenderer::send($paymentUIToken, $isSandbox = true); ?>
</body>
</html>
<script>
var options = {
access_token: 'abcdef1234567890abcdef1234567890'
};
var s = document.createElement('script');
s.type = "text/javascript";
s.async = true;
s.src = "https://static.xsolla.com/embed/paystation/1.0.7/widget.min.js";
s.addEventListener('load', function (e) {
XPayStationWidget.init(options);
}, false);
var head = document.getElementsByTagName('head')[0];
head.appendChild(s);
</script>
<button data-xpaystation-widget-open>Buy Credits</button>
テスト用クレジットカードの一覧
サンドボックスでは、これらのカードを使用して決済の成功をシミュレートすることができます。
カード番号 | 有効期限 | CVV2 | 3Dセキュア | カードの種類 |
---|---|---|---|---|
4111111111111111 | 12/20 | 123 | No | VISA |
5555555555554444 | 11/19 | 321 | No | MasterCard |
4000000000000010 | 12/20 | 123 | Yes | VISA |
5200000000000114 | 11/19 | 321 | Yes | MasterCard |
6759649826438453 | 12/25 | 321 | Yes | Maestro |
さらに、以下のデータを使用して、不承認となったトランザクションをシミュレートすることができます。
カード番号 | 有効期限 | CVV2 | 3Dセキュア | カードの種類 | 詳細 |
---|---|---|---|---|---|
4000000000000002 | 12/20 | 123 | No | VISA | Insufficient funds |
5200000000000007 | 11/19 | 321 | No | MasterCard | Insufficient funds |
4000000000000036 | 12/20 | 123 | Yes | VISA | Declined |
5200000000000031 | 11/19 | 321 | Yes | MasterCard | Declined |
Pay2Playウィジェット
Pay2Playウィジェットを使うと、ウェブサイトに決済インターフェースを簡単に実装することができます。ウィジェットの挿入は簡単で、ゲームの詳細、利用可能なDRMとプラットフォーム、決済方法をユーザに提供します。
スクリプトは、CDN からダウンロードできます。このURLを使用して、Webサイトにスクリプトを統合してください。
詳細については、当社のGitHubリポジトリをご覧ください。
Pay2Playの統合には2つのオプションがあります。
- 簡単な統合
- 高度な統合
2つのオプションの違いについては、統合ガイドを参照してください。 ウィジェットの初期化パラメータはオプションによって異なります。
簡単な統合
スクリプト初期化パラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
access_data | string | ユーザーと決済の詳細(オブジェクト)。 必須。 |
theme | object | ウィジェットのテーマ。 |
theme.foreground | string | ウィジェットの前景色。 |
theme.background | string | ウィジェットの背景色 |
target_element | boolean | ウィジェットを含むページ要素のjQueryセレクタ(例: "#widget-example")。 必須。 |
access_dataオブジェクトのパラメータと構造は、トークンに使用されているものと似ています。
高度な統合
スクリプト初期化パラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
access_token | string | ウィジェットのトークン、API経由で受信。 必須。 |
sandbox | boolean | 決済処理をテストするには、trueに設定します.sambox-secure.xsolla.comがsecure.xsolla.comの代わりに使用されます。 |
theme | object | ウィジェットのテーマ。 |
theme.foreground | string | ウィジェットの前景色。 |
theme.background | string | ウィジェットの背景色 |
target_element | boolean | ウィジェットを含むページ要素のjQueryセレクタ(例: "#widget-example")。 必須。 |
次のパラメータは、決済インターフェースのテーマを定義します。同じパラメータがXsolla Pay Station ウィジェットに使用されます。
パラメータ | 種類 | 説明 |
---|---|---|
lightbox | object | ライトボックスパラメータ(オブジェクト、デスクトップバージョンのみ)。 |
lightbox.width | string | ライトボックスのフレーム幅。nullの場合、Pay Stationの幅に依存します。既定はnullです。 |
lightbox.height | string | ライトボックスのフレームの高さ。nullの場合、Pay Stationの高さに依存します。既定は'100%'です。 |
lightbox.zIndex | int | 配置順序を定義します。既定は1000です。 |
lightbox.overlayOpacity | int | オーバーレイ不透明度(0〜1)。既定は '.6'です。 |
lightbox.overlayBackground | string | オーバーレイの背景色。既定は '#000000'です。 |
lightbox.modal | boolean | Trueの場合、ライトボックスフレームを閉じることはできません。既定は 'false'です。 |
lightbox.closeByClick | boolean | Trueの場合、オーバーレイをクリックするとライトボックスが閉じます。既定は 'true'です。 |
lightbox.closeByKeyboard | boolean | Trueの場合、ESCを押すとライトボックスが閉じます。既定は 'true'です。 |
lightbox.contentBackground | string | フレームの背景色。既定は '#ffffff'です。 |
lightbox.contentMargin | string | フレームマージン。既定は'10px'です。 |
lightbox.spinner | string | ローディングアニメーションのインジケータの種類。'xsolla'または 'round'に指定できます。既定は 'xsolla'です。 |
lightbox.spinnerColor | string | スピナーの色。既定値はありません。 |
childWindow | object | Pay Station UIを含む子ウィンドウのオプション。モバイル版でサポートされています。 |
childWindow.target | string | Pay Stationウィンドウを開く場所。'_blank'、'_self'、'_parent'に指定できます。既定は '_blank'です。 |
DOMが完全に読み込まれた後にXPay2PlayWidget.create()を呼び出すようにしてください。目的のイベントを追跡したり、ウィジェットを含む要素の後にスクリプトを追加することができます。
例:簡単な統合のためのコールバックによる非同期スクリプトの読み込み。
<script>
var accessData = {"settings":{"project_id":14004},"purchase":{"pin_codes":{"codes":[{"digital_content":"game_sku"}]}}};
var options = {
access_data: accessData,
theme :{
foreground: 'green',
background: 'light'
},
target_element: '#widget-example-element'
};
var s = document.createElement('script');
s.type = "text/javascript";
s.async = true;
s.src = "//static.xsolla.com/embed/pay2play/2.1.0/widget.min.js";
s.addEventListener('load', function (e) {
var widgetInstance = XPay2PlayWidget.create(options);
}, false);
var head = document.getElementsByTagName('head')[0];
head.appendChild(s);
</script>
<script>
var accessData = {"settings":{"project_id":14004},"purchase":{"pin_codes":{"codes":[{"digital_content":"game_sku"}]}}};
var options = {
access_data: accessData,
theme :{
foreground: 'green',
background: 'light'
},
target_element: '#widget-example-element'
};
var s = document.createElement('script');
s.type = "text/javascript";
s.async = true;
s.src = "//static.xsolla.com/embed/pay2play/2.1.0/widget.min.js";
s.addEventListener('load', function (e) {
var widgetInstance = XPay2PlayWidget.create(options);
}, false);
var head = document.getElementsByTagName('head')[0];
head.appendChild(s);
</script>
例:高度な統合のためのコールバックによる非同期スクリプトの読み込み。
<script>
var options = {
access_token: 'abcdef1234567890abcdef1234567890',
theme :{
foreground: 'green',
background: 'light'
},
target_element: '#widget-example-element'
};
var s = document.createElement('script');
s.type = "text/javascript";
s.async = true;
s.src = "//static.xsolla.com/embed/pay2play/2.1.0/widget.min.js";
s.addEventListener('load', function (e) {
var widgetInstance = XPay2PlayWidget.create(options);
}, false);
var head = document.getElementsByTagName('head')[0];
head.appendChild(s);
</script>
<script>
var options = {
access_token: 'abcdef1234567890abcdef1234567890',
theme :{
foreground: 'green',
background: 'light'
},
target_element: '#widget-example-element'
};
var s = document.createElement('script');
s.type = "text/javascript";
s.async = true;
s.src = "//static.xsolla.com/embed/pay2play/2.1.0/widget.min.js";
s.addEventListener('load', function (e) {
var widgetInstance = XPay2PlayWidget.create(options);
}, false);
var head = document.getElementsByTagName('head')[0];
head.appendChild(s);
</script>
エラーリスト
Code | Description |
---|---|
0004-0001 | トークンの有効期限が切れている、またはトークンが不正です |
0004-0008 | URLが間違っています (secure.xsolla.comのサンドボックス・モードまたはsandbox-secure.xsolla.comの本番モードにアクセスしようとしています) |
0002-0004 | 同意に署名されていません |
0004-0010 | サーバーレス統合が禁止されています |
0010-0001 | デジタル・コンテンツが見つかりません |
0010-0003 | デジタル・コンテンツにDRMが設定されていません |
1000-0003 | プロジェクトの支払いモジュールが有効になっていません |
ストアフロント仮想通貨パッケージの一覧
ストアフロントの仮想通貨パッケージをすべて一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/virtual_currency
リクエストパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 必須。 |
user_id | string | ユーザーID。 必須。 |
currency | string | 仮想通貨パッケージの通貨。ISO 4217の3文字の通貨コード。 必須。 |
language | string | インタフェース言語。 ISO 639-1の2文字の小文字の言語コード。 必須。 |
###レスポンスパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
packages | array | 仮想通貨パッケージ(array of objects)。 |
packages.id | int | Xsollaデータベースの仮想通貨パッケージID。 |
packages.quantity | float | 仮想通貨量。 |
packages.quantity_without_discount | float | 値引き前の量(プロモーションの場合)。 |
packages.bonus_quantity | float | ボーナスとして与えられる仮想通貨の数量(プロモーションの場合)。 |
packages.amount | float | 仮想通貨パッケージ価格(リクエストで定義された通貨)。 |
packages.amount_without_discount | float | 値引き前の仮想通貨パッケージ価格(プロモーションの場合)。 |
packages.currency | string | 仮想通貨パッケージを購入するために使用される通貨。ISO 4217 3文字通貨コード。 |
packages.image | string | パッケージに使用される画像のURL。 |
packages.description | string | パッケージの説明(リクエストで定義された言語で表示)。 |
packages.bonus_items | array | ボーナスとして与えられる仮想アイテム(プロモーションの場合)。 |
packages.bonus_items.name | string | アイテム名。 |
packages.bonus_items.quantity | int | 数量。 |
packages.advertisement_label | object | パッケージラベル(オブジェクト)。 |
packages.advertisement_label.type | string | ラベルの種類。"recommended"、"best_deal"、"special_offer"、またはnullに指定できます。 |
packages.advertisement_label.name | string | ローカライズされたラベル名(packages.advertisement_label.typeに依存する)。 |
packages.offer_label | string | プロモーションのラベル。 |
リクエスト
<?php
$response = $xsollaClient->GetStorefrontVirtualCurrency(array(
'project_id' => PROJECT_ID,
'language' => LANGUAGE_ISO,
'currency' => CURRENCY_ISO,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/storefront/virtual_currency HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/virtual_currency' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'packages' =>
array (
array (
'id' => 16913,
'quantity' => 500,
'quantity_without_discount' => 500,
'bonus_quantity' => 10,
'amount' => 4,
'amount_without_discount' => 4.99,
'currency' => 'USD',
'image' => '//cdn2.xsolla.com/img/misc/images/5df58528dee219c2ab48e003f8f1a8f1.jpg',
'description' => '500 Gold',
'bonus_items' =>
array (
array (
'name' => 'Rabbit',
'quantity' => 1,
),
),
'advertisement_label' =>
array (
'type' => 'recommended',
'name' => 'Most Popular',
),
'offer_label' => '',
),
),
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"packages":[
{
"id": 16913,
"quantity":500,
"quantity_without_discount":500,
"bonus_quantity": 10,
"amount": 4,
"amount_without_discount": 4.99,
"currency": "USD",
"image": "\/\/cdn2.xsolla.com\/img\/misc\/images\/5df58528dee219c2ab48e003f8f1a8f1.jpg",
"description": "500 Gold",
"bonus_items":[
{
"name": "Rabbit",
"quantity": 1
}
],
"advertisement_label":{
"type": "recommended",
"name": "Most Popular"
},
"offer_label": ""
}
]
}
{
"packages":[
{
"id": 16913,
"quantity":500,
"quantity_without_discount":500,
"bonus_quantity": 10,
"amount": 4,
"amount_without_discount": 4.99,
"currency": "USD",
"image": "\/\/cdn2.xsolla.com\/img\/misc\/images\/5df58528dee219c2ab48e003f8f1a8f1.jpg",
"description": "500 Gold",
"bonus_items":[
{
"name": "Rabbit",
"quantity": 1
}
],
"advertisement_label":{
"type": "recommended",
"name": "Most Popular"
},
"offer_label": ""
}
]
}
ストアフロントグループの一覧
仮想アイテムのすべてのグループを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/virtual_items/groups
リクエストパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 必須。 |
user_id | string | ユーザーID。 必須。 |
currency | string | 仮想通貨パッケージの通貨。ISO 4217の3文字の通貨コード。 必須。 |
language | string | インタフェース言語。 ISO 639-1の2文字の小文字の言語コード。 必須。 |
###レスポンスパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
groups | array | 仮想アイテムのグループ。 |
groups.id | int | XsollaデータベースのグループID。 |
groups.external_id | string | グループ外部ID。 |
groups.name | string | ローカライズされたグループ名。 |
groups.description | string | ローカライズされたグループの説明。 |
groups.level | int | グループレベル。 |
groups.children | array | 子グループ。親グループと同じ構造を持ちます。 |
リクエスト
<?php
$response = $xsollaClient->GetStorefrontVirtualGroups(array(
'project_id' => PROJECT_ID,
'language' => LANGUAGE_ISO,
'currency' => CURRENCY_ISO,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/storefront/virtual_items/groups HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/virtual_items/groups' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'groups' =>
array (
array (
'id' => 1,
'external_id' => '21',
'name' => 'Group name 21',
'description' => 'Group description 21',
'children' =>
array (),
'level' => 0,
),
array (
'id' => 2,
'external_id' => '22',
'name' => 'Group name 22',
'description' => 'Group description 22',
'children' =>
array (
array (
'id' => 3,
'external_id' => NULL,
'name' => 'Child group 1',
'description' => 'Child group 1',
'children' =>
array (),
'level' => 1,
),
array (
'id' => 8,
'external_id' => NULL,
'name' => 'Child group 2',
'description' => 'Child group 2',
'children' =>
array (),
'level' => 1,
),
),
'level' => 0,
),
),
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"groups":[
{
"id": 1,
"external_id": "21",
"name": "Group name 21",
"description": "Group description 21",
"children":[],
"level": 0
},
{
"id": 2,
"external_id": "22",
"name": "Group name 22",
"description": "Group description 22",
"children":[
{
"id": 3,
"external_id": null,
"name": "Child group 1",
"description": "Child group 1",
"children":[],
"level": 1
},
{
"id": 8,
"external_id": null,
"name": "Child group 2",
"description": "Child group 2",
"children":[],
"level": 1
}
],
"level": 0
}
]
}
{
"groups":[
{
"id": 1,
"external_id": "21",
"name": "Group name 21",
"description": "Group description 21",
"children":[],
"level": 0
},
{
"id": 2,
"external_id": "22",
"name": "Group name 22",
"description": "Group description 22",
"children":[
{
"id": 3,
"external_id": null,
"name": "Child group 1",
"description": "Child group 1",
"children":[],
"level": 1
},
{
"id": 8,
"external_id": null,
"name": "Child group 2",
"description": "Child group 2",
"children":[],
"level": 1
}
],
"level": 0
}
]
}
ストアフロント仮想アイテムの一覧
ストアフロントのすべての仮想アイテムを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/virtual_items/items
リクエストパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 必須。 |
user_id | string | ユーザーID。 必須。 |
group_id | int | 仮想アイテムグループID。 必須。 |
currency | string | 仮想通貨パッケージの通貨。ISO 4217の3文字の通貨コード。 必須。 |
language | string | インタフェース言語。 ISO 639-1の2文字の小文字の言語コード。 必須。 |
###レスポンスパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
items | array | 仮想アイテム(array of objects)。 |
items.id | int | Xsollaデータベースの仮想アイテムID。 |
items.sku | string | 仮想アイテムSKU。 |
items.name | string | ローカライズされた名前。 |
items.image_url | string | 仮想アイテムに使用される画像のURL。 |
items.description | string | ローカライズされた説明文。 |
items.long_description | string | ローカライズされた説明文の詳細版。 |
items.currency | string | 仮想アイテムの購入に使用される通貨。ISO 4217 3文字通貨コード。 |
items.amount | float | 仮想アイテム価格(リクエストで定義された通貨)。 |
items.amount_without_discount | float | 値引き前の仮想アイテム価格(プロモーションの場合)。 |
items.vc_amount | float | 仮想通貨での仮想アイテムの価格。 |
items.vc_amount_without_discount | float | 値引き前の仮想通貨での仮想アイテムの価格(宣伝の場合)。 |
items.bonus_virtual_currency | object | ボーナスとして与えられる仮想通貨(プロモーションの場合)。 |
items.bonus_virtual_currency.vc_amount | float | 仮想通貨の数量。 |
items.bonus_virtual_items | array | ボーナスとして与えられる仮想アイテム(プロモーションの場合)。 |
items.bonus_virtual_items.name | string | ローカライズされた名前。 |
items.bonus_virtual_items.quantity | int | 数量。 |
items.advertisement_label | object | 仮想アイテムラベル(オブジェクト)。 |
items.advertisement_label.type | string | ラベルの種類。"recommended"、"best_deal"、"special_offer"、またはnullに指定できます。 |
items.advertisement_label.name | string | ローカライズされたラベル名(items.advertisement_label.typeに依存する)。 |
items.offer_label | string | プロモーションのラベル。 |
リクエスト
<?php
$response = $xsollaClient->GetStorefrontVirtualItems(array(
'project_id' => PROJECT_ID,
'language' => LANGUAGE_ISO,
'currency' => CURRENCY_ISO,
'user_id' => USER_ID,
'group_id' => GROUP_ID
));
GET /merchant/v2/projects/{project_id}/storefront/virtual_items/items HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/virtual_items/items' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'items' =>
array (
array (
'id' => 1678,
'sku' => '1468',
'name' => 'Rabbit',
'image_url' => 'https://cdn3.xsolla.com/img/misc/merchant-digital-goods/4376c004fa33dc74483906561d617cb3.png',
'description' => 'Rabbits are small mammals in the family Leporidae',
'long_description' => NULL,
'currency' => 'USD',
'amount' => 0,
'amount_without_discount' => 0,
'vc_amount' => 2,
'vc_amount_without_discount' => 2,
'bonus_virtual_currency' => NULL,
'bonus_virtual_items' =>
array (),
'advertisement_label' => NULL,
'offer_label' => '',
),
),
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"items":[
{
"id": 1678,
"sku": "1468",
"name": "Rabbit",
"image_url": "https:\/\/cdn3.xsolla.com\/img\/misc\/merchant-digital-goods\/4376c004fa33dc74483906561d617cb3.png",
"description": "Rabbits are small mammals in the family Leporidae",
"long_description": null,
"currency": "USD",
"amount": 0,
"amount_without_discount": 0,
"vc_amount": 2,
"vc_amount_without_discount": 2,
"bonus_virtual_currency": null,
"bonus_virtual_items":[],
"advertisement_label": null,
"offer_label": ""
}
]
}
{
"items":[
{
"id": 1678,
"sku": "1468",
"name": "Rabbit",
"image_url": "https:\/\/cdn3.xsolla.com\/img\/misc\/merchant-digital-goods\/4376c004fa33dc74483906561d617cb3.png",
"description": "Rabbits are small mammals in the family Leporidae",
"long_description": null,
"currency": "USD",
"amount": 0,
"amount_without_discount": 0,
"vc_amount": 2,
"vc_amount_without_discount": 2,
"bonus_virtual_currency": null,
"bonus_virtual_items":[],
"advertisement_label": null,
"offer_label": ""
}
]
}
ストアフロントのサブスクリプションプランの一覧
すべてのサブスクリプションプランのリストを取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/subscriptions
リクエストパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 必須。 |
user_id | string | ユーザーID。 必須。 |
currency | string | 仮想通貨パッケージの通貨。ISO 4217の3文字の通貨コード。 必須。 |
language | string | インタフェース言語。 ISO 639-1の2文字の小文字の言語コード。 必須。 |
###レスポンスパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
packages | array | サブスクリプションプラン(array of objects)。 |
packages.id | int | XsollaデータベースのサブスクリプションプランID。 |
packages.is_active | boolean | プランが有効かどうかを示します。 |
packages.charge_amount | float | プラン価格。 |
packages.charge_amount_without_discount | float | プランの非割引価格(プロモーションの場合)。 |
packages.charge_currency | string | プランの通貨。ISO 4217 3文字通貨コード。 |
packages.period | int | 請求サイクル(時間単位の数)。 |
packages.period_unit | string | 請求サイクルの時間単位(day/month)。 |
packages.name | string | ローカライズされた名前。 |
packages.description | string | ローカライズされた説明文。 |
packages.bonus_virtual_currency | object | ボーナスとして与えられる仮想通貨(プロモーションの場合)。 |
packages.bonus_virtual_currency.vc_amount | float | 仮想通貨の数量。 |
packages.bonus_virtual_items | array | ボーナスとして与えられる仮想アイテム(プロモーションの場合)。 |
packages.bonus_virtual_items.name | string | ローカライズされた名前。 |
packages.bonus_virtual_items.quantity | int | 数量。 |
packages.offer_label | string | プロモーションのラベル。 |
packages.is_trial | boolean | プランの試用期間を使用するかどうかを示します。 |
packages.period_trial | int | 試用期間(日)。 |
active_user_package | object | ユーザーのアクティブなサブスクリプション(オブジェクト)。 |
active_user_package.date_next_charge | string | アクティブなサブスクリプションの次の請求日。日付時刻表記は、ISO 8601形式。 |
active_user_package.id | string | アクティブなサブスクリプションプランID。 |
リクエスト
<?php
$response = $xsollaClient->GetStorefrontSubscriptions(array(
'project_id' => PROJECT_ID,
'language' => LANGUAGE_ISO,
'currency' => CURRENCY_ISO,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/storefront/subscriptions HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/subscriptions' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'packages' =>
array (
array (
'id' => '2.99_1_months',
'is_active' => true,
'charge_amount' => 2.99,
'charge_amount_without_discount' => 2.99,
'charge_currency' => 'USD',
'period' => 1,
'period_unit' => 'month',
'name' => 'Silver Status',
'description' => NULL,
'bonus_virtual_currency' => NULL,
'bonus_virtual_items' =>
array (),
'offer_label' => '',
'is_trial' => false,
'period_trial' => 0,
),
array (
'id' => '4.99_1_months',
'is_active' => true,
'charge_amount' => 4.99,
'charge_amount_without_discount' => 4.99,
'charge_currency' => 'USD',
'period' => 1,
'period_unit' => 'month',
'name' => 'Gold Status',
'description' => NULL,
'bonus_virtual_currency' => NULL,
'bonus_virtual_items' =>
array (),
'offer_label' => '',
'is_trial' => false,
'period_trial' => 0,
),
),
'active_user_package' =>
array (
'date_next_charge' => '2016-06-28T06:35:02+00:00',
'id' => '2.99_1_months'
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"packages":[
{
"id": "2.99_1_months",
"is_active": true,
"charge_amount": 2.99,
"charge_amount_without_discount": 2.99,
"charge_currency": "USD",
"period": 1,
"period_unit": "month",
"name": "Silver Status",
"description": null,
"bonus_virtual_currency": null,
"bonus_virtual_items":[],
"offer_label": "",
"is_trial": false,
"period_trial": 0
},
{
"id": "4.99_1_months",
"is_active": true,
"charge_amount": 4.99,
"charge_amount_without_discount": 4.99,
"charge_currency": "USD",
"period": 1,
"period_unit": "month",
"name": "Gold Status",
"description": null,
"bonus_virtual_currency": null,
"bonus_virtual_items":[],
"offer_label": "",
"is_trial": false,
"period_trial": 0
}
],
"active_user_package":{
"date_next_charge": "2016-06-28T06:35:02+00:00",
"id": "2.99_1_months"
}
}
{
"packages":[
{
"id": "2.99_1_months",
"is_active": true,
"charge_amount": 2.99,
"charge_amount_without_discount": 2.99,
"charge_currency": "USD",
"period": 1,
"period_unit": "month",
"name": "Silver Status",
"description": null,
"bonus_virtual_currency": null,
"bonus_virtual_items":[],
"offer_label": "",
"is_trial": false,
"period_trial": 0
},
{
"id": "4.99_1_months",
"is_active": true,
"charge_amount": 4.99,
"charge_amount_without_discount": 4.99,
"charge_currency": "USD",
"period": 1,
"period_unit": "month",
"name": "Gold Status",
"description": null,
"bonus_virtual_currency": null,
"bonus_virtual_items":[],
"offer_label": "",
"is_trial": false,
"period_trial": 0
}
],
"active_user_package":{
"date_next_charge": "2016-06-28T06:35:02+00:00",
"id": "2.99_1_months"
}
}
ストアフロント・プロモーションの取得
現在アクティブなプロモーションを取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/bonus
リクエストパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 必須。 |
user_id | string | ユーザーID。 必須。 |
currency | string | 仮想通貨パッケージの通貨。ISO 4217の3文字の通貨コード。 必須。 |
language | string | インタフェース言語。 ISO 639-1の2文字の小文字の言語コード。 必須。 |
###レスポンスパラメータ:
パラメータ | 種類 | 説明 |
---|---|---|
seconds | int | プロモーションの終了までの秒数。 |
name | string | ローカライズされたプロモーション名。 |
description | string | ローカライズされたプロモーションの説明。 |
リクエスト
<?php
$response = $xsollaClient->GetStorefrontBonus(array(
'project_id' => PROJECT_ID,
'language' => LANGUAGE_ISO,
'currency' => CURRENCY_ISO,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/storefront/bonus HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/storefront/bonus' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'seconds' => 619513283,
'name' => 'Promotion name',
'description' => 'Promotion description',
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"seconds": 619513283,
"name": "Promotion name",
"description": "Promotion description"
}
{
"seconds": 619513283,
"name": "Promotion name",
"description": "Promotion description"
}
保存された決済アカウントの一覧
特定のユーザーの保存された決済アカウントを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ユーザーID |
リクエスト
<?php
$response = $xsollaClient->ListPaymentAccounts(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'type' => 'card',
'id' => 1,
'name' => '411111******1111',
'payment_system' =>
array (
'id' => 1380,
'name' => 'Credit/Debit Cards',
),
),
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"type": "card",
"id": 1,
"name": "411111******1111",
"payment_system":{
"id": 1380,
"name": "Credit/Debit Cards"
}
}
]
[
{
"type": "card",
"id": 1,
"name": "411111******1111",
"payment_system":{
"id": 1380,
"name": "Credit/Debit Cards"
}
}
]
保存された決済アカウントを介して請求
保存された決済アカウントを介してユーザーに請求する。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 必須。 |
user_id | int | ユーザーID。 必須。 |
type | string | 決済アカウントの種類:カード/ PayPal。 必須。 |
account_id | int | Xsollaデータベースに保存されたアカウントのID。 必須。 |
user | object | ユーザーの詳細(オブジェクト)。 |
user.ip | string | ユーザーのIPアドレス。 必須。 |
user.name | string | ユーザー名。 |
purchase | object | 購入の詳細を含むオブジェクト。 |
purchase.virtual_currency | object | 仮想通貨の詳細を含むオブジェクト。 |
purchase.virtual_currency.quantity | float | 仮想通貨での購入金額。 |
purchase.checkout | object | チェックアウトの詳細(オブジェクト)。 |
purchase.checkout.currency | string | 購入通貨。ISO 4217 3文字通貨コード。 |
purchase.checkout.amount | float | 購入金額。 |
settings | object | 購入設定(オブジェクト)。 |
settings.mode | string | 決済処理をテストするには、"sandbox"に設定します。実際の決済用にパラメータを削除します。 |
リクエスト
<?php
$response = $xsollaClient->ChargePaymentAccount(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'type' => TYPE,
'account_id' => ACCOUNT_ID,
'request' => array (
'user' =>
array (
'ip' => '127.0.0.1',
'name' => 'John Smith',
),
'purchase' =>
array (
'virtual_currency' =>
array (
'quantity' => 100,
),
'description' =>
array (
'value' => 'Test Purchase',
),
),
'settings' =>
array (
'mode' => 'sandbox',
),
)
));
POST /merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"user":{
"ip": "127.0.0.1",
"name": "John Smith"
},
"purchase":{
"virtual_currency":{
"quantity": 100
},
"description":{
"value": "Test Purchase"
}
},
"settings":{
"mode": "sandbox"
}
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"user":{
"ip": "127.0.0.1",
"name": "John Smith"
},
"purchase":{
"virtual_currency":{
"quantity": 100
},
"description":{
"value": "Test Purchase"
}
},
"settings":{
"mode": "sandbox"
}
}'
レスポンス
<?php
// example response
$response = array (
'transaction_id' => 119478390
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"transaction_id": 119478390
}
{
"transaction_id": 119478390
}
保存された決済アカウントの削除
保存済みの決済アカウントを削除します。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ユーザーID |
type | string | 決済アカウントの種類:カード/ PayPal。 |
account_id | int | Xsollaデータベースに保存されたアカウントのID。 |
リクエスト
<?php
$response = $xsollaClient->DeletePaymentAccount(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'type' => TYPE,
'account_id' => ACCOUNT_ID
));
DELETE /merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = null;
HTTP/1.1 204 No Content
プランの作成
サブスクリプションプランを作成します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
external_id | string | プラン外部ID(32文字)。 任意。 |
name | array of strings | プラン名。"language":"plan name"のペアで構成されます。 |
description | array of strings | プランの説明文。"language":"plan description"のペアで構成されます。 |
group_id | string | グループID。 |
charge | object | 請求の詳細(オブジェクト)。 |
charge.period | object | 請求期間(オブジェクト)。 |
charge.period.value | int | 時間単位の数。 |
charge.period.type | string | 時間単位: day / month。 |
charge.amount | float | 請求額。 |
charge.currency | string | 購入通貨。ISO 4217 3文字通貨コード。 |
expiration | object | サブスクリプションの有効期限の詳細(オブジェクト)。 |
expiration.value | int | 有効期間。 |
expiration.type | string | 時間単位: day / month。 |
trial | object | 試用期間の詳細(オブジェクト)。 任意。 |
trial.value | int | 試行期間。 |
trial.type | string | 時間単位: day。 |
grace_period | object | 猶予期間の詳細。任意。 |
grace_period.value | int | 猶予期間。 |
grace_period.type | string | 時間単位: day。 |
リクエスト
<?php
$response = $xsollaClient->CreateSubscriptionPlan(array(
'project_id' => PROJECT_ID,
'request' => array (
'external_id' => 'sample_plan',
'name' =>
array (
'en' => 'Sample Plan',
),
'description' =>
array (
'en' => 'Basic options plan',
),
'group_id' => 'USA Products',
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month',
),
'amount' => 10,
'currency' => 'USD',
),
'expiration' =>
array (
'value' => '',
'type' => '',
),
)
));
POST /merchant/v2/projects/{project_id}/subscriptions/plans HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"group_id": "USA Products",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": "",
"type": ""
}
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"group_id": "USA Products",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD",
},
"expiration":{
"value": "",
"type": ""
}
}'
レスポンス
<?php
// example response
$response = array (
'plan_id' => 54
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"plan_id": 54
}
{
"plan_id": 54
}
プランの更新
サブスクリプションプランを更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
plan_id | int | プランID。 |
external_id | string | プラン外部ID(32文字)。 任意。 |
name | array of strings | プラン名。"language":"plan name"のペアで構成されます。 |
description | array of strings | プランの説明文。"language":"plan description"のペアで構成されます。 |
group_id | string | グループID。 |
charge | object | 請求の詳細(オブジェクト)。 |
charge.period | object | 請求期間(オブジェクト)。 |
charge.period.value | int | 時間単位の数。 |
charge.period.type | string | 時間単位: day / month。 |
charge.amount | float | 請求額。 |
charge.currency | string | 購入通貨。ISO 4217 3文字通貨コード。 |
expiration | object | サブスクリプションの有効期限の詳細(オブジェクト)。 |
expiration.value | int | 有効期間。 |
expiration.type | string | 時間単位: day / month。 |
trial | object | 試用期間の詳細(オブジェクト)。 任意。 |
trial.value | int | 試行期間。 |
trial.type | string | 時間単位: day。 |
grace_period | object | 猶予期間の詳細。任意。 |
grace_period.value | int | 猶予期間。 |
grace_period.type | string | 時間単位: day。 |
リクエスト
<?php
$response = $xsollaClient->UpdateSubscriptionPlan(array(
'project_id' => PROJECT_ID,
'plan_id' => PLAN_ID,
'request' => array (
'external_id' => 'sample_plan',
'name' =>
array (
'en' => 'Sample Plan',
),
'description' =>
array (
'en' => 'Basic options plan',
),
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month',
),
'amount' => 10,
'currency' => 'USD',
),
'expiration' =>
array (
'value' => '',
'type' => '',
),
)
));
PUT /merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": "",
"type": ""
}
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": "",
"type": ""
}
}'
レスポンス
<?php
// example response
$response = array (
'id' => '54',
'external_id' => 'sample_plan',
'name' =>
array (
'en' => 'Sample Plan'
),
'description' =>
array (
'en' => 'Basic options plan'
),
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month'
),
'amount' => 10,
'currency' => 'USD'
),
'expiration' =>
array (
'value' => '',
'type' => ''
),
'trial' =>
array (
'value' => 14,
'type' => 'day'
),
'status' =>
array (
'value' => 'disabled',
'counters' =>
array (
'active' => 0,
'canceled' => 0,
'expired' => 0
)
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": "54",
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": "",
"type": ""
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"canceled": 0,
"expired": 0
}
}
}
{
"id": "54",
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": "",
"type": ""
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"canceled": 0,
"expired": 0
}
},
"type":
}
プランの削除
サブスクリプションプランを削除します。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
plan_id | int | プランID。 |
リクエスト
<?php
$response = $xsollaClient->DeleteSubscriptionPlan(array(
'project_id' => PROJECT_ID,
'plan_id' => PLAN_ID
));
DELETE /merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}/delete' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
プランの無効化
サブスクリプションプランを無効化します。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
plan_id | int | プランID。 |
リクエスト
<?php
$response = $xsollaClient->DisableSubscriptionPlan(array(
'project_id' => PROJECT_ID,
'plan_id' => PLAN_ID
));
DELETE /merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
プランの有効化
サブスクリプションプランを有効化します。
HTTPリクエスト
PATCH https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
plan_id | int | プランID。 |
リクエスト
<?php
$response = $xsollaClient->EnableSubscriptionPlan(array(
'project_id' => PROJECT_ID,
'plan_id' => PLAN_ID
));
PATCH /merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans/{plan_id}' \
-X PATCH \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
プランの一覧
すべてのサブスクリプションプランを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
external_id | string | プラン外部ID。 |
limit | int | 取得するレコードの最大数。 |
offset | int | 取得する最初のレコードのオフセット。 |
group_id | string | プランがリンクされているグループのID。 |
product_id | int | プランがリンクされている製品のID。 |
リクエスト
<?php
$response = $xsollaClient->ListSubscriptionPlans(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/subscriptions/plans?external_id=1&limit=1&offset=1 HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/plans?external_id=1&limit=1&offset=1' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => '54',
'external_id' => 'sample_plan',
'name' =>
array (
'en' => 'Sample Plan'
),
'description' =>
array (
'en' => 'Basic options plan'
),
'group_id' => 'USA Products',
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month'
),
'amount' => 10,
'currency' => 'USD'
),
'expiration' =>
array (
'value' => 90,
'type' => 'day'
),
'trial' =>
array (
'value' => 14,
'type' => 'day'
),
'status' =>
array (
'value' => 'disabled',
'counters' =>
array (
'active' => 0,
'canceled' => 0,
'expired' => 0
)
)
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": "54",
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"group_id": "USA Products",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"canceled": 0,
"expired": 0
}
}
}
]
[
{
"id": "54",
"external_id": "sample_plan",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"group_id": "USA Products",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD",
},
"expiration":{
"value": 90,
"type": "day",
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"canceled": 0,
"expired": 0
}
}
}
]
製品の作成
サブスクリプション型の製品を作成します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
name | string | 製品名。 |
group_id | string | グループID。 |
リクエスト
<?php
$response = $xsollaClient->CreateSubscriptionProduct(array(
'project_id' => PROJECT_ID,
'request' => array(
'name' => 'Demo Product',
'group_id' => 'USA Products'
),
));
POST /merchant/v2/projects/{project_id}/subscriptions/products HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"name": "Demo Product",
"group_id": "USA Products"
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"name": "Demo Product",
"group_id": "USA Products"
}'
レスポンス
<?php
// example response
$response = array (
'product_id' => '64'
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"product_id": "64"
}
{
"product_id": "64"
}
製品の更新
サブスクリプション型の製品を更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
product_id | int | 製品ID。 |
name | string | 製品名。 |
group_id | string | グループID。 |
リクエスト
<?php
$response = $xsollaClient->UpdateSubscriptionProduct(array(
'project_id' => PROJECT_ID,
'request' => array(
'name' => 'Demo Product',
'group_id' => 'USA Products'
),
));
PUT /merchant/v2/projects/{project_id}/subscriptions/products/{product_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"name": "Demo Product",
"group_id": "USA Products"
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"name": "Demo Product",
"group_id": "USA Products"
}'
レスポンス
<?php
// example response
$response = array (
'id' => '64',
'name' => 'Demo Product',
'group_id' => 'USA Products'
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": "64",
"name": "Demo Product",
"group_id": "USA Products"
}
{
"id": "64",
"name": "Demo Product",
"group_id": "USA Products"
}
製品の削除
サブスクリプション型の製品を削除します。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
product_id | int | 製品ID。 |
リクエスト
<?php
$response = $xsollaClient->DeleteSubscriptionProduct(array(
'project_id' => PROJECT_ID,
'product_id' => PRODUCT_ID
));
DELETE /merchant/v2/projects/{project_id}/subscriptions/products/{product_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products/{product_id}' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
製品の一覧
すべてのサブスクリプション型の製品を一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
group_id | string | 製品がリンクされているグループのID。 |
product_id | int | 製品id。 |
limit | int | 取得するレコードの最大数。 |
offset | int | 取得する最初のレコードのオフセット。 |
リクエスト
<?php
$response = $xsollaClient->DeleteSubscriptionProduct(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/subscriptions/products?group_id=USA%20Products&limit=1&offset=1 HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/products?group_id=USA%20Products&limit=1&offset=1' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 3,
'group_id' => 'USA Products',
'name' => 'Demo Product'
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 3,
"group_id": "USA Products",
"name": "Demo Product"
}
]
[
{
"id": 3,
"group_id": "USA Products",
"name": "Demo Product"
}
]
サブスクリプションの更新
ステータスを変更(active、canceled、またはnon_renewing)したり、次の請求日を延期することによって、サブスクリプションを更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
subscription_id | int | サブスクリプションID。 |
user_id | string | ユーザーID |
status | string | ステータス:active / canceled / non_renewing。 |
cancel_subscription_payment | boolean | Trueに設定すると、このサブスクリプションで最後に支払った決済分が払い戻されます。 canceledに設定したステータスと共にのみ実行できます* |
timeshift | object | 請求延期(オブジェクト)。 |
timeshift.value | string | 請求を延期する時間単位の数。負の値に設定すると、請求日が繰り上げられます。 |
timeshift.type | string | 時間単位: day / month。 |
リクエスト
<?php
$response = $xsollaClient->UpdateSubscription(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'subscription_id' => SUBSCRIPTION_ID,
'request' => array (
'status' => 'canceled',
'timeshift' =>
array (
'value' => '30',
'type' => 'day',
)
)
));
PUT /merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"status": "canceled",
"timeshift":{
"value": "30",
"type": "day"
}
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/{subscription_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"status": "canceled",
"timeshift":{
"value": "30",
"type": "day"
}
}'
レスポンス
<?php
// example response
$response = array (
'id' => 45,
'plan' =>
array (
'id' => '54',
'external_id' => 'sample_plan',
'group_id' => 'USA Products',
'project_id' => 14004,
'name' =>
array (
'en' => 'Sample Plan'
),
'description' =>
array (
'en' => 'Basic options plan'
),
'localized_name' => 'Basic Plan',
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month'
),
'amount' => 10,
'currency' => 'USD'
),
'expiration' =>
array (
'value' => 90,
'type' => 'day'
),
'trial' =>
array (
'value' => 14,
'type' => 'day'
),
'status' =>
array (
'value' => 'active',
'counters' =>
array (
'active' => 0,
'canceled' => 1,
'expired' => 0
)
)
),
'user' =>
array (
'id' => '20',
),
'product' => null,
'charge_amount' => 10,
'currency' => 'USD',
'date_create' => '2014-09-30T15:34:17+06:00',
'date_end' => '2014-10-07T15:34:17+06:00',
'date_last_charge' => '2014-10-01T15:34:17+06:00',
'date_next_charge' => '2014-11-01T15:34:17+06:00',
'status' => 'canceled'
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"project_id": 14004,
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "active",
"counters":{
"active": 0,
"canceled": 1,
"expired": 0
}
}
},
"user":{
"id": "20"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+06:00",
"date_end": "2014-10-07T15:34:17+06:00",
"date_last_charge": "2014-10-01T15:34:17+06:00",
"date_next_charge": "2014-11-01T15:34:17+06:00",
"status": "canceled"
}
{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"project_id": 14004,
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "active",
"counters":{
"active": 0,
"canceled": 1,
"expired": 0
}
}
},
"user":{
"id": "20"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+06:00",
"date_end": "2014-10-07T15:34:17+06:00",
"date_last_charge": "2014-10-01T15:34:17+06:00",
"date_next_charge": "2014-11-01T15:34:17+06:00",
"status": "canceled"
}
サブスクリプションの一覧
すべてのサブスクリプションを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 必須。 |
user_id | string | ゲーム内のユーザID。必須。 |
status | string | ステータス: active / canceled / non_renewing / new. |
limit | int | 取得するレコードの最大数。 |
offset | int | 取得する最初のレコードのオフセット。 |
datetime_from | datetime | 期間開始日。 |
datetime_to | datetime | 期間終了日。 |
plan_id | string | プランID。 |
product_id | string | 製品ID。 |
リクエスト
<?php
$response = $xsollaClient->ListSubscriptions(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/users/{user_id}/subscriptions?status=active&limit=1&offset=1&datetime_from=2014-10-01T00%3A00%3A00Z&datetime_to=2014-10-02T00%3A00%3A00Z HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions?status=active&limit=1&offset=1&datetime_from=2014-10-01T00%3A00%3A00Z&datetime_to=2014-10-02T00%3A00%3A00Z' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 45,
'plan' =>
array (
'id' => '54',
'external_id' => 'sample_plan',
'group_id' => 'USA Products',
'project_id' => 14004,
'name' =>
array (
'en' => 'Sample Plan'
),
'description' =>
array (
'en' => 'Basic options plan'
),
'localized_name' => 'Basic Plan',
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month'
),
'amount' => 10,
'currency' => 'USD'
),
'expiration' =>
array (
'value' => 90,
'type' => 'day'
),
'trial' =>
array (
'value' => 14,
'type' => 'day'
),
'status' =>
array (
'value' => 'disabled',
'counters' =>
array (
'active' => 0,
'canceled' => 0,
'expired' => 0
)
)
),
'user' =>
array (
'id' => '20'
),
'product' => null,
'charge_amount' => 10,
'currency' => 'USD',
'date_create' => '2014-09-30T15:34:17+04:00',
'date_end' => '2014-10-07T15:34:17+04:00',
'date_last_charge' => '2014-10-01T15:34:17+04:00',
'date_next_charge' => null,
'status' => 'active'
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"project_id": 14004,
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"canceled": 0,
"expired": 0
}
}
},
"user":{
"id": "20"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+04:00",
"date_end": "2014-10-07T15:34:17+04:00",
"date_last_charge": "2014-10-01T15:34:17+04:00",
"date_next_charge": null,
"status": "active"
}
]
[
{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"project_id": 14004,
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"canceled": 0,
"expired": 0
}
}
},
"user":{
"id": "20"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+04:00",
"date_end": "2014-10-07T15:34:17+04:00",
"date_last_charge": "2014-10-01T15:34:17+04:00",
"date_next_charge": null,
"status": "active"
}
]
決済の一覧
すべてのサブスクリプションの決済を一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ゲーム内のユーザーID。 |
status | string | ステータス:processing / canceled / done。 |
limit | int | 取得するレコードの最大数。 |
offset | int | 取得する最初のレコードのオフセット。 |
datetime_from | datetime | 期間開始日。 |
datetime_to | datetime | 期間終了日。 |
subscription_id | int | サブスクリプションID。 |
リクエスト
<?php
$response = $xsollaClient->ListSubscriptionPayments(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/subscriptions/payments?status=done&limit=1&offset=1&datetime_from=2014-10-01T00%3A00%3A00Z&datetime_to=2014-10-02T00%3A00%3A00Z HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/payments?status=done&limit=1&offset=1&datetime_from=2014-10-01T00%3A00%3A00Z&datetime_to=2014-10-02T00%3A00%3A00Z' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 35,
'id_payment' => 118441192,
'date_payment' => '2014-09-30T15:34:17+04:00',
'status' => 'done',
'subscription' =>
array (
'id' => 45,
'plan' =>
array (
'id' => '54',
'external_id' => 'sample_plan',
'group_id' => 'USA Products',
'name' =>
array (
'en' => 'Sample Plan'
),
'description' =>
array (
'en' => 'Basic options plan'
),
'localized_name' => 'Basic Plan',
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month'
),
'amount' => 10,
'currency' => 'USD'
),
'expiration' =>
array (
'value' => 90,
'type' => 'day'
),
'trial' =>
array (
'value' => 14,
'type' => 'day'
),
'status' =>
array (
'value' => 'disabled',
'counters' =>
array (
'active' => 0,
'closed' => 0,
'expired' => 0
)
)
),
'user' =>
array (
'id' => 20,
'name' => 'John Smith'
),
'product' => null,
'charge_amount' => 10,
'currency' => 'USD',
'date_create' => '2014-09-30T15:34:17+04:00',
'date_end' => '2014-10-07T15:34:17+04:00',
'date_last_charge' => '2014-10-01T15:34:17+04:00',
'date_next_charge' => '2014-11-01T15:34:17+04:00',
'status' => 'done'
)
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 35,
"id_payment": 118441192,
"date_payment": "2014-09-30T15:34:17+04:00",
"status": "done",
"subscription":{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"closed": 0,
"expired": 0
}
}
},
"user":{
"id": 20,
"name": "John Smith"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+04:00",
"date_end": "2014-10-07T15:34:17+04:00",
"date_last_charge": "2014-10-01T15:34:17+04:00",
"date_next_charge": "2014-11-01T15:34:17+04:00",
"status": "done"
}
}
]
[
{
"id": 35,
"id_payment": 118441192,
"date_payment": "2014-09-30T15:34:17+04:00",
"status": "done",
"subscription":{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"closed": 0,
"expired": 0
}
}
},
"user":{
"id": 20,
"name": "John Smith"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+04:00",
"date_end": "2014-10-07T15:34:17+04:00",
"date_last_charge": "2014-10-01T15:34:17+04:00",
"date_next_charge": "2014-11-01T15:34:17+04:00",
"status": "done"
}
}
]
ユーザの決済の一覧
特定のユーザーが行ったすべての決済を一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/payments
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ゲーム内のユーザーID。 |
status | string | ステータス:processing / canceled / done。 |
limit | int | 取得するレコードの最大数。 |
offset | int | 取得する最初のレコードのオフセット。 |
datetime_from | datetime | 期間開始日。 |
datetime_to | datetime | 期間終了日。 |
subscription_id | int | サブスクリプションID。 |
リクエスト
<?php
$response = $xsollaClient->ListUserSubscriptionPayments(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/payments?status=done&limit=1&offset=1&datetime_from=2014-10-01T00%3A00%3A00Z&datetime_to=2014-10-02T00%3A00%3A00Z HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/subscriptions/payments?status=done&limit=1&offset=1&datetime_from=2014-10-01T00%3A00%3A00Z&datetime_to=2014-10-02T00%3A00%3A00Z' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 35,
'id_payment' => 118441192,
'date_payment' => '2014-09-30T15:34:17+04:00',
'status' => 'done',
'subscription' =>
array (
'id' => 45,
'plan' =>
array (
'id' => '54',
'external_id' => 'sample_plan',
'group_id' => 'USA Products',
'project_id' => 14004,
'name' =>
array (
'en' => 'Sample Plan'
),
'description' =>
array (
'en' => 'Basic options plan'
),
'localized_name' => 'Basic Plan',
'charge' =>
array (
'period' =>
array (
'value' => 1,
'type' => 'month'
),
'amount' => 10,
'currency' => 'USD'
),
'expiration' =>
array (
'value' => 90,
'type' => 'day'
),
'trial' =>
array (
'value' => 14,
'type' => 'day'
),
'status' =>
array (
'value' => 'disabled',
'counters' =>
array (
'active' => 0,
'closed' => 0,
'expired' => 0
)
)
),
'user' =>
array (
'id' => 20,
'name' => 'John Smith'
),
'product' => null,
'charge_amount' => 10,
'currency' => 'USD',
'date_create' => '2014-09-30T15:34:17+04:00',
'date_end' => '2014-10-07T15:34:17+04:00',
'date_last_charge' => '2014-10-01T15:34:17+04:00',
'date_next_charge' => '2014-11-01T15:34:17+04:00',
'status' => 'done'
)
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 35,
"id_payment": 118441192,
"date_payment": "2014-09-30T15:34:17+04:00",
"status": "done",
"subscription":{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"project_id": 14004,
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"closed": 0,
"expired": 0
}
}
},
"user":{
"id": 20,
"name": "John Smith"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+04:00",
"date_end": "2014-10-07T15:34:17+04:00",
"date_last_charge": "2014-10-01T15:34:17+04:00",
"date_next_charge": "2014-11-01T15:34:17+04:00",
"status": "done"
}
}
]
[
{
"id": 35,
"id_payment": 118441192,
"date_payment": "2014-09-30T15:34:17+04:00",
"status": "done",
"subscription":{
"id": 45,
"plan":{
"id": "54",
"external_id": "sample_plan",
"group_id": "USA Products",
"project_id": 14004,
"name":{
"en": "Sample Plan"
},
"description":{
"en": "Basic options plan"
},
"localized_name": "Basic Plan",
"charge":{
"period":{
"value": 1,
"type": "month"
},
"amount": 10,
"currency": "USD"
},
"expiration":{
"value": 90,
"type": "day"
},
"trial":{
"value": 14,
"type": "day"
},
"status":{
"value": "disabled",
"counters":{
"active": 0,
"closed": 0,
"expired": 0
}
}
},
"user":{
"id": 20,
"name": "John Smith"
},
"product": null,
"charge_amount": 10,
"currency": "USD",
"date_create": "2014-09-30T15:34:17+04:00",
"date_end": "2014-10-07T15:34:17+04:00",
"date_last_charge": "2014-10-01T15:34:17+04:00",
"date_next_charge": "2014-11-01T15:34:17+04:00",
"status": "done"
}
}
]
通貨の一覧
サポートされているすべてのサブスクリプション通貨を一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
リクエスト
<?php
$response = $xsollaClient->ListSubscriptionCurrencies(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/subscriptions/currencies HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/subscriptions/currencies' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array(
"AED",
"ALL",
"AMD",
"ARS",
"AUD",
"AZN",
"BGN",
"BRL",
"BYR",
"CAD",
"CHF",
"CLP",
"CNY",
"COP",
"CZK",
"DKK",
"DZD",
"EGP",
"EUR",
"GBP",
"GEL",
"HKD",
"HRK",
"HUF",
"IDR",
"ILS",
"INR",
"JPY",
"KES",
"KGS",
"KRW",
"KZT",
"MAD",
"MDL",
"MKD",
"MNT",
"MXN",
"MYR",
"NGN",
"NOK",
"NZD",
"PEN",
"PHP",
"PKR",
"PLN",
"RON",
"RSD",
"RUB",
"SAR",
"SEK",
"SGD",
"THB",
"TRY",
"UAH",
"USD",
"UYU",
"UZS",
"VND",
"ZAR"
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
"AED",
"ALL",
"AMD",
"ARS",
"AUD",
"AZN",
"BGN",
"BRL",
"BYR",
"CAD",
"CHF",
"CLP",
"CNY",
"COP",
"CZK",
"DKK",
"DZD",
"EGP",
"EUR",
"GBP",
"GEL",
"HKD",
"HRK",
"HUF",
"IDR",
"ILS",
"INR",
"JPY",
"KES",
"KGS",
"KRW",
"KZT",
"MAD",
"MDL",
"MKD",
"MNT",
"MXN",
"MYR",
"NGN",
"NOK",
"NZD",
"PEN",
"PHP",
"PKR",
"PLN",
"RON",
"RSD",
"RUB",
"SAR",
"SEK",
"SGD",
"THB",
"TRY",
"UAH",
"USD",
"UYU",
"UZS",
"VND",
"ZAR"
]
[
"AED",
"ALL",
"AMD",
"ARS",
"AUD",
"AZN",
"BGN",
"BRL",
"BYR",
"CAD",
"CHF",
"CLP",
"CNY",
"COP",
"CZK",
"DKK",
"DZD",
"EGP",
"EUR",
"GBP",
"GEL",
"HKD",
"HRK",
"HUF",
"IDR",
"ILS",
"INR",
"JPY",
"KES",
"KGS",
"KRW",
"KZT",
"MAD",
"MDL",
"MKD",
"MNT",
"MXN",
"MYR",
"NGN",
"NOK",
"NZD",
"PEN",
"PHP",
"PKR",
"PLN",
"RON",
"RSD",
"RUB",
"SAR",
"SEK",
"SGD",
"THB",
"TRY",
"UAH",
"USD",
"UYU",
"UZS",
"VND",
"ZAR"
]
ユーザー属性の一覧
すべてのユーザー属性を一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
リクエスト
<?php
$response = $xsollaClient->ListUserAttributes(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/user_attributes HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 2,
'key' => 'level',
'localized_name' =>
array (
'en' => 'Level'
),
'name' => 'Level',
'type' => 'int',
'list_of_values' =>
array (
),
'visible' => true,
'skip_condition_on_nonexistent_key' => false
),
array (
'id' => 3,
'key' => 'class',
'localized_name' =>
array (
)
'name' => null,
'type' => 'string',
'list_of_values' =>
array (
),
'visible' => true,
'skip_condition_on_nonexistent_key' => false
),
array (
'id' => 4,
'key' => 'type',
'localized_name' =>
array (
)
'name' => null,
'type' => 'enum',
'list_of_values' =>
array (
0 => 'class1',
1 => 'class2',
2 => 'class3'
),
'visible' => true,
'skip_condition_on_nonexistent_key' => false
),
array (
'id' => 5,
'key' => 'date',
'localized_name' =>
array (
'en' => 'Date'
),
'name' => 'Date',
'type' => 'date',
'list_of_values' =>
array (
),
'visible' => true,
'skip_condition_on_nonexistent_key' => false
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 2,
"key": "level",
"localized_name":{
"en": "Level"
},
"name": "Level",
"type": "int",
"list_of_values":[],
"visible":true,
"skip_condition_on_nonexistent_key": false
},
{
"id": 3,
"key": "class",
"localized_name":[],
"name": null,
"type": "string",
"list_of_values":[],
"visible":true
},
{
"id": 4,
"key": "type",
"localized_name":[],
"name": null,
"type": "enum",
"list_of_values":[
"class1",
"class2",
"class3"
],
"visible":true,
"skip_condition_on_nonexistent_key": false
},
{
"id": 5,
"key": "date",
"localized_name":{
"en": "Date"
},
"name": "Date",
"type": "date",
"list_of_values":[],
"visible":true,
"skip_condition_on_nonexistent_key": false
}
]
[
{
"id": 2,
"key": "level",
"localized_name":{
"en": "Level"
},
"name": "Level",
"type": "int",
"list_of_values":[],
"visible":true,
"skip_condition_on_nonexistent_key": false
},
{
"id": 3,
"key": "class",
"localized_name":[],
"name": null,
"type": "string",
"list_of_values":[],
"visible":true,
"skip_condition_on_nonexistent_key": false
},
{
"id": 4,
"key": "type",
"localized_name":[],
"name": null,
"type": "enum",
"list_of_values":[
"class1",
"class2",
"class3"
],
"visible":true,
"skip_condition_on_nonexistent_key": false
},
{
"id": 5,
"key": "date",
"localized_name":{
"en": "Date"
},
"name": "Date",
"type": "date",
"list_of_values":[],
"visible":true,
"skip_condition_on_nonexistent_key": false
}
]
ユーザー属性の取得
特定のユーザー属性の詳細を取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_attribute_id | int | ユーザー属性ID。 |
リクエスト
<?php
$response = $xsollaClient->GetUserAttribute(array(
'project_id' => PROJECT_ID,
'user_attribute_id' => USER_ATTRIBUTE_ID
));
GET /merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'id' => 2,
'key' => 'level',
'localized_name' =>
array (
'en' => 'level',
'de' => 'niveau'
),
'name' => 'Level',
'type' => 'int',
'list_of_values' =>
array (),
'visible' => true,
'skip_condition_on_nonexistent_key' => false
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": 2,
"key": "level",
"localized_name":{
"en": "level",
"de": "niveau"
},
"name": "Level",
"type": "int",
"list_of_values":[],
"visible":true,
"skip_condition_on_nonexistent_key": false
}
{
"id": 2,
"key": "level",
"localized_name":{
"en": "level",
"de": "niveau"
},
"name": "Level",
"type": "int",
"list_of_values":[],
"visible":true,
"skip_condition_on_nonexistent_key": false
}
ユーザー属性の作成
ユーザー属性を作成します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 必須。 |
key | string | ユーザー属性のキー。 必須。 |
name | array of strings | ローカライズされた属性名。 必須。 |
type | string | キーの種類。'int'、'string'、'enum'、または'date'に指定できます。必須。 |
list_of_values | array | type=enum(array)に可能な値です。 必須。 |
skip_condition_on_nonexistent_key | boolean | キーが存在しない場合は条件をスキップするかどうかを示します。 |
リクエスト
<?php
$response = $xsollaClient->CreateUserAttribute(array(
'project_id' => PROJECT_ID,
'request' => array (
'key' => 'class',
'name' =>
array (
'en' => 'Сlass',
'de' => 'Classe',
),
'type' => 'enum',
'list_of_values' =>
array (
'Warrior',
'magic',
),
)
));
POST /merchant/v2/projects/{project_id}/user_attributes HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"key": "class",
"name":{
"en": "Сlass",
"de": "Classe"
},
"type": "enum",
"list_of_values": ["Warrior", "magic"],
"visible":true
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"key": "class",
"name":{
"en": "Сlass",
"de": "Classe"
},
"type": "enum",
"list_of_values": ["Warrior", "magic"],
"visible":true
}'
レスポンス
<?php
// example response
$response = array (
'id' => 77
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"id": 77
}
{
"id": 77
}
ユーザー属性の更新
ユーザー属性を更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_attribute_id | int | ユーザー属性ID。 |
key | string | ユーザー属性キー。>* 400 Bad Request — これは必要なパラメーターが欠落していることを示します。 |
name | array of strings | ローカライズされたユーザー属性名(配列)。 |
type | string | キーの種類。'int'、'string'、'enum'、または'date'を指定できます。>* 400 Bad Request — これは必要なパラメーターが欠落していることを示します。 |
list_of_values | array | type=enumの可能な値(配列)。 |
skip_condition_on_nonexistent_key | boolean | キーが存在しない場合は条件をスキップするかどうかを示します。 |
リクエスト
<?php
$response = $xsollaClient->UpdateUserAttribute(array(
'project_id' => PROJECT_ID,
'user_attribute_id' => USER_ATTRIBUTE_ID,
'request' => array(
'key' => 'class',
'name' =>
array (
'en' => 'Сlass',
'de' => 'Classe',
),
'type' => 'enum',
'list_of_values' =>
array (
'Warrior',
'magic',
),
'skip_condition_on_nonexistent_key' => false
)
));
PUT /merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"key": "class",
"localized_name":{
"en": "Сlass",
"de": "Classe"
},
"type": "enum",
"list_of_values": ["Warrior", "magic"],
"visible":true,
"skip_condition_on_nonexistent_key": false
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"key": "class",
"localized_name":{
"en": "Сlass",
"de": "Classe"
},
"type": "enum",
"list_of_values": ["Warrior", "magic"],
"visible":true,
"skip_condition_on_nonexistent_key": false
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
ユーザー属性の削除
ユーザー属性を削除します。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_attribute_id | int | ユーザー属性ID。 |
リクエスト
<?php
$response = $xsollaClient->DeleteUserAttribute(array(
'project_id' => PROJECT_ID,
'user_attribute_id' => USER_ATTRIBUTE_ID
));
DELETE /merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/user_attributes/{user_attribute_id}' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
仮想アイテムの作成。
仮想アイテムを作成します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲーム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 | 仮想アイテムの種類:Consumable / Expiration / Permanent |
expiration | int | 有効期限までの時間(秒単位)。 ** 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 | int | 仮想通貨での仮想アイテムの価格。'null'の場合、現金通貨でのみアイテムを購入できます。 |
purchase_limit | int | アイテムを購入できる回数(nullの場合は無制限)。 |
keywords | array | 決済インターフェースでアイテムを検索するために使用できるキーワード。 |
リクエスト
<?php
$response = $xsollaClient->CreateVirtualItem(array(
'project_id' => PROJECT_ID,
'request' => array (
'sku' => 'T-43-3-unique-id',
'item_code' => 'chinese-medium-tank',
'name' =>
array (
'en' => 'T-34-3',
),
'description' =>
array (
'en' => 'Chinese Tier VIII medium tank.',
),
'long_description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.',
),
'prices' =>
array (
'USD' => 40.09,
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'item_type' => 'Expiration',
'expiration' => 1296000,
'groups' =>
array (
24,
25,
),
'user_attribute_conditions' =>
array (
array (
'right_operand' =>
array (
'magic',
),
'id' => 2015,
'user_attribute_key' => 'type',
'operation' => 'equal',
'action' => 'hide',
'name' => null,
),
),
'virtual_currency_price' => null,
'purchase_limit' => null,
'keywords' =>
array (
'de' =>
array (
'Inhalt',
'Aufgaben',
'Region',
'Landschaft',
),
'en' =>
array (
'content',
'quests',
'region',
'landscape',
),
),
'advertisement_type' => 'recommended',
'deleted' => false,
)
));
POST /merchant/v2/projects/{project_id}/virtual_items/items HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "Expiration",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "Expiration",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}'
レスポンス
<?php
// example response
$response = array (
'item_id' => 77
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"item_id": 77
}
{
"item_id": 77
}
仮想アイテムの取得
仮想アイテムを取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}
パラメータ | 種類 | 説明 |
---|---|---|
item_id | int | アイテムID。 |
リクエスト
<?php
$response = $xsollaClient->GetVirtualItem(array(
'project_id' => PROJECT_ID,
'item_id' => ITEM_ID
));
GET /merchant/v2/projects/{project_id}/virtual_items/items/{item_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'id' => 77,
'sku' => 'T-43-3-unique-id',
'item_code' => 'chinese-medium-tank',
'name' =>
array (
'en' => 'T-34-3'
),
'description' =>
array (
'en' => 'Chinese Tier VIII medium tank.'
),
'long_description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.'
),
'prices' =>
array (
'USD' => 40.09
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'item_type' => 'Expiration',
'expiration' => 1296000,
'groups' =>
array (
24,
25
),
'user_attribute_conditions' =>
array (
array (
'right_operand' =>
array (
'magic',
),
'id' => 2015,
'user_attribute_key' => 'type',
'operation' => 'equal',
'action' => 'hide',
'name' => null,
),
),
'virtual_currency_price' => null,
'purchase_limit' => null,
'keywords' =>
array (
'de' =>
array (
'Inhalt',
'Aufgaben',
'Region',
'Landschaft',
),
'en' =>
array (
'content',
'quests',
'region',
'landscape',
),
),
'advertisement_type' => 'recommended',
'deleted' => false,
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "Expiration",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}
{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "Expiration",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}
仮想アイテムの更新
仮想アイテムを更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}
パラメータ | 種類 | 説明 |
---|---|---|
item_id | int | アイテム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 | 仮想アイテムの種類:Consumable / Expiration / Permanent |
expiration | int | 有効期限までの時間(秒単位)。 ** 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 | int | 仮想通貨での仮想アイテムの価格。'null'の場合、現金通貨でのみアイテムを購入できます。 |
purchase_limit | int | アイテムを購入できる回数(nullの場合は無制限)。 |
keywords | array | 決済インターフェースでアイテムを検索するために使用できるキーワード。 |
リクエスト
<?php
$response = $xsollaClient->UpdateVirtualItem(array(
'project_id' => PROJECT_ID,
'request' => array (
'sku' => 'T-43-3-unique-id',
'item_code' => 'chinese-medium-tank',
'name' =>
array (
'en' => 'T-34-3',
),
'description' =>
array (
'en' => 'Chinese Tier VIII medium tank.',
),
'long_description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.',
),
'prices' =>
array (
'USD' => 40.09,
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'item_type' => 'Expiration',
'expiration' => 1296000,
'groups' =>
array (
24,
25,
),
'user_attribute_conditions' =>
array (
array (
'right_operand' =>
array (
'magic',
),
'id' => 2015,
'user_attribute_key' => 'type',
'operation' => 'equal',
'action' => 'hide',
'name' => null,
),
),
'virtual_currency_price' => null,
'purchase_limit' => null,
'keywords' =>
array (
'de' =>
array (
'Inhalt',
'Aufgaben',
'Region',
'Landschaft',
),
'en' =>
array (
'content',
'quests',
'region',
'landscape',
),
),
'advertisement_type' => 'recommended',
'deleted' => false,
)
));
PUT /merchant/v2/projects/{project_id}/virtual_items/items/{item_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "Expiration",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "Expiration",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
仮想アイテムの削除
仮想アイテムを削除します。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}
パラメータ | 種類 | 説明 |
---|---|---|
item_id | int | アイテムID。 |
リクエスト
<?php
$response = $xsollaClient->DeleteVirtualItem(array(
'project_id' => PROJECT_ID,
'item_id' => ITEM_ID
));
DELETE /merchant/v2/projects/{project_id}/virtual_items/items/{item_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
仮想アイテムの一覧
仮想アイテムを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
offset | int | 取得する最初のレコードのオフセット。 |
limit | int | 取得するレコードの最大数。 |
has_price | string | 価格種類:'virtual_currency'または'real_currency'、仮想通貨または現金通貨で購入できるかどうかを示します。 |
リクエスト
<?php
$response = $xsollaClient->ListVirtualItems(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/virtual_items/items HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 46,
'sku' => 'T-43-3-unique-id',
'localized_name' => 'T-34-3',
'prices' =>
array (
'USD' => 40.09
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'groups' =>
array (
25
),
'advertisement_type' => null,
'virtual_currency_price' => null
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 46,
"sku": "T-43-3-unique-id",
"localized_name": "T-34-3",
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"groups":[
25
],
"advertisement_type": null,
"virtual_currency_price": null
}
]
[
{
"id": 46,
"sku": "T-43-3-unique-id",
"localized_name": "T-34-3",
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"groups":[
25
],
"advertisement_type": null,
"virtual_currency_price": null
}
]
グループの作成
仮想アイテム用のグループを作成する。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
name | array of strings | ローカライズされたグループ名(配列)。 |
description | array of strings | ローカライズされたグループの説明文(配列)。 |
enabled | boolean | グループの有効化。 |
parent_id | int | 親グループのID。 |
code | int | グループの固有コード。 |
リクエスト
<?php
$response = $xsollaClient->CreateVirtualItemsGroup(array(
'project_id' => PROJECT_ID,
'request' => array (
'name' =>
array (
'en' => 'Tanks',
),
'description' =>
array (
'en' => 'Tanks Group',
),
'enabled' => true,
'parent_id' => null,
'code' => null
)
));
POST /merchant/v2/projects/{project_id}/virtual_items/groups HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"name":{
"en": "Tanks"
},
"description":{
"en": "Tanks Group"
},
"enabled": true,
"parent_id": null,
"code": null
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"name":{
"en": "Tanks"
},
"description":{
"en": "Tanks Group"
},
"enabled": true,
"parent_id": null,
"code": null
}'
レスポンス
<?php
// example response
$response = array (
'group_id' => 7
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"group_id": 7
}
{
"group_id": 7
}
グループの取得
仮想アイテムグループの詳細を取得する
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}
パラメータ | 種類 | 説明 |
---|---|---|
group_id | int | グループID。 |
リクエスト
<?php
$response = $xsollaClient->GetVirtualItemsGroup(array(
'project_id' => PROJECT_ID,
'group_id' => GROUP_ID
));
GET /merchant/v2/projects/{project_id}/virtual_items/groups/{group_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'id' => 25,
'name' =>
array (
'en' => 'Tanks'
),
'description' =>
array (
'en' => 'Tanks Group'
),
'enabled' => true,
'parent_id' => null,
'code' => null
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": 25,
"name":{
"en": "Tanks"
},
"description":{
"en": "Tanks Group"
},
"enabled": true,
"parent_id": null,
"code": null
}
{
"id": 25,
"name":{
"en": "Tanks"
},
"description":{
"en": "Tanks Group"
},
"enabled": true,
"parent_id": null,
"code": null
}
グループの更新
仮想アイテム用のグループを更新する。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}
パラメータ | 種類 | 説明 |
---|---|---|
group_id | int | グループID。 |
name | array of strings | ローカライズされたグループ名(配列)。 |
description | array of strings | ローカライズされたグループの説明文(配列)。 |
enabled | boolean | グループの有効化。 |
parent_id | int | 親グループのID。 |
code | int | グループの固有コード。 |
リクエスト
<?php
$response = $xsollaClient->UpdateVirtualItemsGroup(array(
'project_id' => PROJECT_ID,
'group_id' => GROUP_ID,
'request' => array (
'name' =>
array (
'en' => 'Tanks',
),
'description' =>
array (
'en' => 'Tanks Group',
),
'enabled' => true,
'parent_id' => null,
'code' => null
)
));
PUT /merchant/v2/projects/{project_id}/virtual_items/groups/{group_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"name":{
"en": "Tanks"
},
"description":{
"en": "Tanks Group"
},
"enabled": true,
"parent_id": null,
"code": null
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"name":{
"en": "Tanks"
},
"description":{
"en": "Tanks Group"
},
"enabled": true,
"parent_id": null,
"code": null
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
グループの削除
仮想アイテム用のグループを削除する。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}
パラメータ | 種類 | 説明 |
---|---|---|
group_id | int | グループID。 |
リクエスト
<?php
$response = $xsollaClient->DeleteVirtualItemsGroup(array(
'project_id' => PROJECT_ID,
'group_id' => GROUP_ID
));
DELETE /merchant/v2/projects/{project_id}/virtual_items/groups/{group_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups/{group_id}' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
グループの一覧化
すべての仮想アイテムを一覧表示する。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
リクエスト
<?php
$response = $xsollaClient->ListVirtualItemsGroups(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/virtual_items/groups HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/groups' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 25,
'localized_name' => 'Tanks',
'enabled' => true,
'parent_id' => null,
'has_groups' => false,
'has_virtual_items' => true,
'virtual_items_count' => 6,
'code' => null
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 25,
"localized_name": "Tanks",
"enabled": true,
"parent_id": null,
"has_groups": false,
"has_virtual_items": true,
"virtual_items_count": 6,
"code": null
}
]
[
{
"id": 25,
"localized_name": "Tanks",
"enabled": true,
"parent_id": null,
"has_groups": false,
"has_virtual_items": true,
"virtual_items_count": 6,
"code": null
}
]
Lootboxの作成
Lootboxの作成。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲーム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 | アイテムの種類:'lootbox' |
expiration | int | ライフタイム(秒)。 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 | int | ゲーム内通貨での価格。'null'の場合、現金通貨でのみアイテムを購入できます。 |
purchase_limit | int | アイテムを購入できる回数。'null'の場合、購入できる回数に制限はありません。 |
keywords | array | 決済インターフェースでアイテムを検索するために使用できるキーワード。 |
key_virtual_item_id | int | Lootboxを開く仮想アイテムのID。 |
opening_price_vc | int | Lootboxを開く仮想通貨での価格。 |
slots | array | Lootboxのスロット。各スロットにドロップできるアイテムのセットを指定する配列。 |
slots.id | int | スロットID。 |
slots.value | object | スロットのコンテンツ。各スロットのdrop_rateの合計は100%でなければなりません。 |
slots.value.virtual_item | array | スロットにドロップできる仮想アイテム。 |
slots.value.virtual_item.id | int | アイテムID。 |
slots.value.virtual_item.amount | float | アイテム数量。 |
slots.value.virtual_item.drop_rate | decimal | アイテムがスロットにドロップする確率(小数点以下2桁まで) |
slots.value.virtual_currency | object | スロットにドロップできる仮想通貨。 |
slots.value.virtual_currency.amount | float | 通貨量。 |
slots.value.virtual_currency.drop_rate | decimal | アイテムがスロットにドロップする確率(小数点以下2桁まで) |
slots.value.attribute | array | スロットにドロップできるアイテムの属性。 |
slots.value.attribute.type | int | Lootboxにドロップするアイテムを選択するために使用される属性タイプ。 |
slots.value.attribute.value | string | 属性値。例:"rare"。 |
slots.value.attribute.drop_rate | string | 属性がスロットにドロップする確率(小数点以下2桁まで) |
slots.compensation_for_duplicate_percent | int | 重複したアイテムに対する仮想通貨での賠償(アイテム価格の割合)。 |
slots.compensation_for_duplicate_value | float | 重複したアイテムに対する仮想通貨での賠償(絶対値)。 |
limits | object | Lootboxのアイテム数に関する制約。 |
limits.virtual_item | object | 仮想アイテムの制約。 |
limits.virtual_item.id | int | アイテムID。 |
limits.virtual_item.max_items | int | アイテムをlootboxにドロップできる最大回数。 |
limits.attribute | object | 属性の制約。 |
limits.attribute.type | int | 制約に使用される属性の種類。 |
limits.attribute.value | string | 制約に使用される属性値。 |
limits.attribute.max_items | int | 属性をlootboxにドロップできる最大回数。 |
リクエスト
<?php
$response = $xsollaClient->CreateVirtualItem(array(
'project_id' => PROJECT_ID,
'request' => array (
'sku' => 'T-43-3-unique-id',
'item_code' => 'chinese-medium-tank',
'name' =>
array (
'en' => 'T-34-3',
),
'description' =>
array (
'en' => 'Chinese Tier VIII medium tank.',
),
'long_description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.',
),
'prices' =>
array (
'USD' => 40.09,
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'item_type' => 'lootbox',
'expiration' => 1296000,
'groups' =>
array (
24,
25,
),
'user_attribute_conditions' =>
array (
array (
'right_operand' =>
array (
'magic',
),
'id' => 2015,
'user_attribute_key' => 'type',
'operation' => 'equal',
'action' => 'hide',
'name' => null,
),
),
'virtual_currency_price' => null,
'purchase_limit' => null,
'keywords' =>
array (
'de' =>
array (
'Inhalt',
'Aufgaben',
'Region',
'Landschaft',
),
'en' =>
array (
'content',
'quests',
'region',
'landscape',
),
),
'advertisement_type' => 'recommended',
'deleted' => false,
)
));
POST /merchant/v2/projects/{project_id}/virtual_items/items HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "lootbox",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false,
"slots":[
{
"id":123,
"value":{
"virtual_items":[
{
"id":123,
"amount":10,
"drop_rate":20
},
{
"id":321,
"amount":15,
"drop_rate":50
}
],
"attribute":[
{
"type":1,
"value":"rare",
"drop_rate":20
}
],
"virtual_currency":[
{
"amount":100,
"drop_rate":10
}
]
},
"compensation_for_duplicate_percent":10,
"compensation_for_duplicate_value":50
}
],
"limits":{
"virtual_item":{
"id":123,
"max_items":5
},
"attribute":{
"type":1,
"value":"rare",
"max_items":5
}
}
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "lootbox",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false,
"slots":[
{
"id":123,
"value":{
"virtual_items":[
{
"id":123,
"amount":10,
"drop_rate":20
},
{
"id":321,
"amount":15,
"drop_rate":50
}
],
"attribute":[
{
"type":1,
"value":"rare",
"drop_rate":20
}
],
"virtual_currency":[
{
"amount":100,
"drop_rate":10
}
]
},
"compensation_for_duplicate_percent":10,
"compensation_for_duplicate_value":50
}
],
"limits":{
"virtual_item":{
"id":123,
"max_items":5
},
"attribute":{
"type":1,
"value":"rare",
"max_items":5
}
}
}'
レスポンス
<?php
// example response
$response = array (
'item_id' => 77
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"item_id": 77
}
{
"item_id": 77
}
Lootboxの更新
Lootboxを更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲーム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 | アイテムの種類:'lootbox' |
expiration | int | ライフタイム(秒)。 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 | int | ゲーム内通貨での価格。'null'の場合、現金通貨でのみアイテムを購入できます。 |
purchase_limit | int | アイテムを購入できる回数。'null'の場合、購入できる回数に制限はありません。 |
keywords | array | 決済インターフェースでアイテムを検索するために使用できるキーワード。 |
key_virtual_item_id | int | Lootboxを開く仮想アイテムのID。 |
opening_price_vc | int | Lootboxを開く仮想通貨での価格。 |
slots | array | Lootboxのスロット。各スロットにドロップできるアイテムのセットを指定する配列。 |
slots.id | int | スロットID。 |
slots.value | object | スロットのコンテンツ。各スロットのdrop_rateの合計は100%でなければなりません。 |
slots.value.virtual_item | array | スロットにドロップできる仮想アイテム。 |
slots.value.virtual_item.id | int | アイテムID。 |
slots.value.virtual_item.amount | float | アイテム数量。 |
slots.value.virtual_item.drop_rate | decimal | アイテムがスロットにドロップする確率(小数点以下2桁まで) |
slots.value.virtual_currency | object | スロットにドロップできる仮想通貨。 |
slots.value.virtual_currency.amount | float | 通貨量。 |
slots.value.virtual_currency.drop_rate | decimal | アイテムがスロットにドロップする確率(小数点以下2桁まで) |
slots.value.attribute | array | スロットにドロップできるアイテムの属性。 |
slots.value.attribute.type | int | Lootboxにドロップするアイテムを選択するために使用される属性タイプ。 |
slots.value.attribute.value | string | 属性値。例:"rare"。 |
slots.value.attribute.drop_rate | string | 属性がスロットにドロップする確率(小数点以下2桁まで) |
slots.compensation_for_duplicate_percent | int | 重複したアイテムに対する仮想通貨での賠償(アイテム価格の割合)。 |
slots.compensation_for_duplicate_value | float | 重複したアイテムに対する仮想通貨での賠償(絶対値)。 |
limits | object | Lootboxのアイテム数に関する制約。 |
limits.virtual_item | object | 仮想アイテムの制約。 |
limits.virtual_item.id | int | アイテムID。 |
limits.virtual_item.max_items | int | アイテムをlootboxにドロップできる最大回数。 |
limits.attribute | object | 属性の制約。 |
limits.attribute.type | int | 制約に使用される属性の種類。 |
limits.attribute.value | string | 制約に使用される属性値。 |
limits.attribute.max_items | int | 属性をlootboxにドロップできる最大回数。 |
リクエスト
<?php
$response = $xsollaClient->CreateVirtualItem(array(
'project_id' => PROJECT_ID,
'request' => array (
'sku' => 'T-43-3-unique-id',
'item_code' => 'chinese-medium-tank',
'name' =>
array (
'en' => 'T-34-3',
),
'description' =>
array (
'en' => 'Chinese Tier VIII medium tank.',
),
'long_description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.',
),
'prices' =>
array (
'USD' => 40.09,
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'item_type' => 'lootbox',
'expiration' => 1296000,
'groups' =>
array (
24,
25,
),
'user_attribute_conditions' =>
array (
array (
'right_operand' =>
array (
'magic',
),
'id' => 2015,
'user_attribute_key' => 'type',
'operation' => 'equal',
'action' => 'hide',
'name' => null,
),
),
'virtual_currency_price' => null,
'purchase_limit' => null,
'keywords' =>
array (
'de' =>
array (
'Inhalt',
'Aufgaben',
'Region',
'Landschaft',
),
'en' =>
array (
'content',
'quests',
'region',
'landscape',
),
),
'advertisement_type' => 'recommended',
'deleted' => false,
)
));
POST /merchant/v2/projects/{project_id}/virtual_items/items HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "lootbox",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "lootbox",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
Lootboxの取得
Lootboxに関する情報を取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}
パラメータ | 種類 | 説明 |
---|---|---|
item_id | int | アイテムID。 |
リクエスト
<?php
$response = $xsollaClient->GetVirtualItem(array(
'project_id' => PROJECT_ID,
'item_id' => ITEM_ID
));
GET /merchant/v2/projects/{project_id}/virtual_items/items/{item_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'id' => 77,
'sku' => 'T-43-3-unique-id',
'item_code' => 'chinese-medium-tank',
'name' =>
array (
'en' => 'T-34-3'
),
'description' =>
array (
'en' => 'Chinese Tier VIII medium tank.'
),
'long_description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.'
),
'prices' =>
array (
'USD' => 40.09
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'item_type' => 'lootbox',
'expiration' => 1296000,
'groups' =>
array (
24,
25
),
'user_attribute_conditions' =>
array (
array (
'right_operand' =>
array (
'magic',
),
'id' => 2015,
'user_attribute_key' => 'type',
'operation' => 'equal',
'action' => 'hide',
'name' => null,
),
),
'virtual_currency_price' => null,
'purchase_limit' => null,
'keywords' =>
array (
'de' =>
array (
'Inhalt',
'Aufgaben',
'Region',
'Landschaft',
),
'en' =>
array (
'content',
'quests',
'region',
'landscape',
),
),
'advertisement_type' => 'recommended',
'deleted' => false,
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "lootbox",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}
{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"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."
},
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"item_type": "lootbox",
"expiration": 1296000,
"groups":[
24,
25
],
"user_attribute_conditions":[
{
"right_operand":[
"magic"
],
"id": 2015,
"user_attribute_key": "type",
"operation": "equal",
"action": "hide",
"name":null
}
],
"virtual_currency_price": null,
"purchase_limit": null,
"keywords":{
"de":[
"Inhalt","Aufgaben","Region","Landschaft"
],
"en":[
"content","quests","region","landscape"
]
},
"advertisement_type": "recommended",
"deleted": false
}
Lootboxesの一覧表示
Lootboxの一覧を取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
offset | int | ページ数。 |
limit | int | 1ページあたりのレコード数。 |
has_price | string | 商品を購入するために使用できる通貨の種類。仮想通貨または現実通貨で購入できる商品の場合は、それぞれ'virtual_currency'または'real_currency'とすることができます。 |
リクエスト
<?php
$response = $xsollaClient->ListVirtualItems(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/virtual_items/items HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 46,
'sku' => 'T-43-3-unique-id',
'localized_name' => 'T-34-3',
'prices' =>
array (
'USD' => 40.09
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'groups' =>
array (
25
),
'advertisement_type' => null,
'virtual_currency_price' => null
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 46,
"sku": "T-43-3-unique-id",
"localized_name": "T-34-3",
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"groups":[
25
],
"advertisement_type": null,
"virtual_currency_price": null
}
]
[
{
"id": 46,
"sku": "T-43-3-unique-id",
"localized_name": "T-34-3",
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"groups":[
25
],
"advertisement_type": null,
"virtual_currency_price": null
}
]
Lootboxを開く
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}/open
パラメータ | 種類 | 説明 |
---|---|---|
slots | array | Lootboxのスロット。各スロットにドロップできるアイテムのセットを指定する配列。 |
slots.id | int | スロットID。 |
slots.value | object | スロットのコンテンツ。各スロットのdrop_rateの合計は100%でなければなりません。 |
slots.value.virtual_item | array | スロットにドロップできる仮想アイテム。 |
slots.value.virtual_item.id | int | アイテムID。 |
slots.value.virtual_item.amount | float | アイテム数量。 |
slots.value.virtual_item.drop_rate | decimal | アイテムがスロットにドロップする確率(小数点以下2桁まで) |
slots.value.virtual_currency | object | スロットにドロップできる仮想通貨。 |
slots.value.virtual_currency.amount | float | 通貨量。 |
slots.value.virtual_currency.drop_rate | decimal | アイテムがスロットにドロップする確率(小数点以下2桁まで) |
slots.value.attribute | array | スロットにドロップできるアイテムの属性。 |
slots.value.attribute.type | int | Lootboxにドロップするアイテムを選択するために使用される属性タイプ。 |
slots.value.attribute.value | string | 属性値。例:"rare"。 |
slots.value.attribute.drop_rate | string | 属性がスロットにドロップする確率(小数点以下2桁まで) |
slots.compensation_for_duplicate_percent | int | 重複したアイテムに対する仮想通貨での賠償(アイテム価格の割合)。 |
slots.compensation_for_duplicate_value | float | 重複したアイテムに対する仮想通貨での賠償(絶対値)。 |
リクエスト
<?php
$response = $xsollaClient->GetVirtualItem(array(
'project_id' => PROJECT_ID,
'item_id' => ITEM_ID
));
POST /merchant/v2/projects/{project_id}/virtual_items/items/{item_id}/open HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}/open' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
レスポンス
<?php
HTTP/1.1 200 OK
Lootboxの削除
Lootboxを削除します。
HTTPリクエスト
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}
パラメータ | 種類 | 説明 |
---|---|---|
item_id | int | アイテムID。 |
リクエスト
<?php
$response = $xsollaClient->DeleteVirtualItem(array(
'project_id' => PROJECT_ID,
'item_id' => ITEM_ID
));
DELETE /merchant/v2/projects/{project_id}/virtual_items/items/{item_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_items/items/{item_id}' \
-X DELETE \
-u merchant_id:merchant_api_key
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
仮想通貨パッケージの一覧
プロジェクトで使用可能な仮想通貨パッケージを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
リクエスト
<?php
$response = $xsollaClient->GetProjectVirtualCurrencySettings(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/virtual_currency HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'id' => 1,
'vc_name' =>
array (
'en' => 'Golden Coins'
),
'base' =>
array (
'USD' => 0.04,
'EUR' => 0.03
),
'default_currency' => 'USD',
'min' => 0,
'max' => 0,
'is_currency_discrete' => true,
'allow_user_sum' => true,
'packets' =>
array (
'USD' =>
array (
array (
'id' => 1,
'sku' => 'vc_usd',
'amount' => 100,
'price' => 10,
'image_url' => '//images.storage.com/some_image',
'description' =>
array (
'en' => 'Standard Package'
),
'label' =>
array (
'en' => 'Standard Package'
),
'bonus' => 0,
'advertisement_type' => 'recommended'
'enabled' => true
)
),
'EUR' =>
array (
array (
'id' => 2,
'sku' => 'vc_eur',
'amount' => 80,
'price' => 5,
'image_url' => null,
'description' =>
array (
'en' => 'Standard Package'
),
'label' =>
array (
'en' => 'Standard Package'
),
'bonus' => 0,
'advertisement_type' => 'recommended'
'enabled' => true
)
)
),
'type' => 'packets',
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": 1,
"vc_name":{
"en": "Golden Coins"
},
"base":{
"USD": 0.04,
"EUR": 0.03
},
"default_currency": "USD",
"min": 0,
"max": 0,
"is_currency_discrete": true,
"allow_user_sum": true,
"packets":{
"USD":[
{
"id": 1,
"sku": "vc_usd",
"amount": 100,
"price": 10,
"image_url": "//images.storage.com/some_image",
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
],
"EUR":[
{
"id": 2,
"sku": "vc_eur",
"amount": 80,
"price": 5,
"image_url": null,
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
]
},
"type": "packets"
}
{
"id": 1,
"vc_name":{
"en": "Golden Coins"
},
"base":{
"USD": 0.04,
"EUR": 0.03
},
"default_currency": "USD",
"min": 0,
"max": 0,
"is_currency_discrete": true,
"allow_user_sum": true,
"packets":{
"USD":[
{
"id": 1,
"sku": "vc_usd",
"amount": 100,
"price": 10,
"image_url": "//images.storage.com/some_image",
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
],
"EUR":[
{
"id": 2,
"sku": "vc_eur",
"amount": 80,
"price": 5,
"image_url": null,
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
]
},
"type": "packets"
}
仮想通貨パッケージの更新
プロジェクトの仮想通貨パッケージを更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲーム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 | 仮想通貨パッケージを有効にします。 |
リクエスト
<?php
$response = $xsollaClient->UpdateProjectVirtualCurrencySettings(array(
'project_id' => PROJECT_ID,
'request' => array (
'vc_name' =>
array (
'en' => 'Golden Coins'
),
'base' =>
array (
'USD' => 0.04,
'EUR' => 0.02,
),
'default_currency' => 'USD',
'min' => 0,
'max' => 0,
'is_currency_discrete' => true,
'allow_user_sum' => true,
'packets' =>
array (
'USD' =>
array (
array (
'id' => 1,
'sku' => 'vc_usd',
'amount' => 100,
'price' => 10,
'image_url' => '//images.storage.com/some_image',
'description' =>
array (
'en' => 'Standard Package'
),
'label' =>
array (
'en' => 'Standard Package'
),
'bonus' => 0,
'advertisement_type' => 'recommended'
'enabled' => true
)
),
'EUR' =>
array (
array (
'id' => 2,
'sku' => 'vc_eur',
'amount' => 80,
'price' => 5,
'image_url' => null,
'description' =>
array (
'en' => 'Standard Package'
),
'label' =>
array (
'en' => 'Standard Package'
),
'bonus' => 0,
'advertisement_type' => 'recommended'
'enabled' => true
)
)
),
'type' => 'packets',
)
));
PUT /merchant/v2/projects/{project_id}/virtual_currency HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"vc_name":{
"en": "Golden Coins"
},
"base":{
"USD": 0.04,
"EUR": 0.03
},
"default_currency": "USD",
"min": 0,
"max": 0,
"is_currency_discrete": true,
"allow_user_sum": true,
"packets":{
"USD":[
{
"id": 1,
"sku": "vc_usd",
"amount": 100,
"price": 10,
"image_url": "//images.storage.com/some_image",
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
],
"EUR":[
{
"id": 2,
"sku": "vc_eur",
"amount": 80,
"price": 5,
"image_url": null,
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
]
}
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/virtual_currency' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"vc_name":{
"en": "Golden Coins"
},
"base":{
"USD": 0.04,
"EUR": 0.03
},
"default_currency": "USD",
"min": 0,
"max": 0,
"is_currency_discrete": true,
"allow_user_sum": true,
"packets":{
"USD":[
{
"id": 1,
"sku": "vc_usd",
"amount": 100,
"price": 10,
"image_url": "//images.storage.com/some_image",
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
],
"EUR":[
{
"id": 2,
"sku": "vc_eur",
"amount": 80,
"price": 5,
"image_url": null,
"description":{
"en": "Standard Package"
},
"label":{
"en": "Standard Package"
},
"bonus": 0,
"advertisement_type": "recommended",
"enabled": true
}
]
}
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
ウォレット
このセクションでは、残高確認、入金、資金の引き出し、 およびその他のユーザー関連操作など、ゲームユーザーの残高に該当するメソッドについて説明します。
ユーザーの作成
新しいユーザーを作成します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/users
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 必須。 |
user_id | string | ユーザーID。 必須。 |
user_name | string | ユーザー名。 |
user_custom | string | ユーザー識別のためのカスタムパラメータ。 |
string | Eメール。 |
リクエスト
<?php
$response = $xsollaClient->CreateWalletUser(array(
'project_id' => PROJECT_ID,
'request' => array(
'user_id' => USER_ID
)
));
POST /merchant/v2/projects/{project_id}/users HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"user_id": 1
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"user_id": 1
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
ユーザーの取得
ユーザーの詳細を取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ゲーム内のユーザーのID。 |
リクエスト
<?php
$response = $xsollaClient->GetWalletUser(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID
));
GET /merchant/v2/projects/{project_id}/users/{user_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'user_id' => 0,
'user_name' => 'John',
'user_custom' => 'Smith',
'email' => 'email@example.com',
'register_date' => '2014-10-08T21:44:32+04:00',
'balance' => 100,
'wallet_amount' => 1.5,
'wallet_currency' => 'USD',
'enabled' => true
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"user_id": 0,
"user_name": "John",
"user_custom": "Smith",
"email": "email@example.com",
"register_date": "2014-10-08T21:44:32-08:00",
"balance": 100,
"wallet_amount": 1.5,
"wallet_currency": "USD",
"enabled": true
}
{
"user_id": 0,
"user_name": "John",
"user_custom": "Smith",
"email": "email@example.com",
"register_date": "2014-10-08T21:44:32-08:00",
"balance": 100,
"wallet_amount": 1.5,
"wallet_currency": "USD",
"enabled": true
}
ユーザーの更新
ユーザーの詳細を更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 必須。 |
user_id | string | ゲーム内のユーザID。必須。 |
user_name | string | ユーザー名。 |
user_custom | string | ユーザー識別のためのカスタムパラメータ。 |
string | Eメール。 | |
enabled | boolean | ユーザーが有効かどうかを示します。 必須。 |
リクエスト
<?php
$response = $xsollaClient->UpdateWalletUser(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'request' => array(
'enabled' => true
)
));
PUT /merchant/v2/projects/{project_id}/users/{user_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"enabled": true
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"enabled": true
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
ユーザーの一覧
すべてのユーザーを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 必須。 |
user_requisites | string | ユーザーIDまたは名前。 |
string | ユーザーのEメール。 | |
offset | int | 取得する最初のレコードのオフセット。 必須。 |
limit | int | 取得するレコードの最大数。 必須。 |
リクエスト
<?php
$response = $xsollaClient->ListWalletUsers(array(
'project_id' => PROJECT_ID,
'limit' => 1,
'offset' => 0
));
GET /merchant/v2/projects/{project_id}/users?offset=1&limit=1 HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users?offset=1&limit=1' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'recordsTotal' => 1,
'data' =>
array (
array (
'user_id' => 0,
'user_name' => 'John',
'user_custom' => 'Smith',
'email' => 'email@example.com',
'register_date' => '2014-10-08T21:44:32-08:00',
'balance' => 100,
'wallet_amount' => 1.5,
'wallet_currency' => 'USD',
'enabled' => true
)
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"recordsTotal": 1,
"data":[
{
"user_id": 0,
"user_name": "John",
"user_custom": "Smith",
"email": "email@example.com",
"register_date": "2014-10-08T21:44:32-08:00",
"balance": 100,
"wallet_amount": 1.5,
"wallet_currency": "USD",
"enabled": true
}
]
}
{
"recordsTotal": 1,
"data":[
{
"user_id": 0,
"user_name": "John",
"user_custom": "Smith",
"email": "email@example.com",
"register_date": "2014-10-08T21:44:32-08:00",
"balance": 100,
"wallet_amount": 1.5,
"wallet_currency": "USD",
"enabled": true
}
]
}
トランザクションの一覧
ユーザーのすべてのトランザクションを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/transactions
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 必須。 |
user_id | string | ゲーム内のユーザID。必須。 |
datetime_from | datetime | 期間開始日。 必須。 |
datetime_to | datetime | 期間終了日。 必須。 |
transaction_type | string | トランザクションの種類は、"payment"、"coupon"、"inGamePurchase"、"internal"、または"cancellation"に指定できます。 |
リクエスト
<?php
$response = $xsollaClient->ListWalletUserOperations(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'datetime_from' => '2015-01-01T00:00:00Z',
'datetime_to' => '2016-01-01T00:00:00Z'
));
GET /merchant/v2/projects/{project_id}/users/{user_id}/transactions?datetime_from=2014-10-14T00%3A00%3A00Z&datetime_to=2014-10-15T00%3A00%3A00Z HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/transactions?datetime_from=2014-10-14T00%3A00%3A00Z&datetime_to=2014-10-15T00%3A00%3A00Z' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'operation_id' => 647287,
'transaction_id' => 1234567,
'coupon_id' => null,
'coupon_code' => null,
'transaction_type' => 'invoice',
'comment' => 'Incoming payment',
'date' => '2014-10-28T12:00:00+04:00',
'amount' => 1000,
'sum' => 10,
'currency' => 'USD',
'status' => 'notified',
'user_balance' => 100,
'user_id' => '1234567'
),
array (
'operation_id' => 647288,
'transaction_id' => null,
'coupon_id' => null,
'coupon_code' => 'DemoCoupon',
'transaction_type' => 'coupon',
'comment' => 'Coupon Redeem',
'date' => '2014-10-28T14:00:00+04:00',
'amount' => 0,
'sum' => null,
'currency' => null,
'status' => 'failed',
'user_balance' => 100,
'user_id' => '1234567'
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"operation_id": 647287,
"transaction_id": 1234567,
"coupon_id": null,
"coupon_code": null,
"transaction_type": "invoice",
"comment": "Incoming payment",
"date": "2014-10-28T12:00:00+04:00",
"amount": 1000,
"sum": 10,
"currency": "USD",
"status": "notified",
"user_balance": 100,
"user_id": "1234567"
},
{
"operation_id": 647288,
"transaction_id": null,
"coupon_id": 12345,
"coupon_code": "DemoCoupon",
"transaction_type": "coupon",
"comment": "Coupon Redeem",
"date": "2014-10-28T14:00:00+04:00",
"amount": 0,
"sum": null,
"currency": null,
"status": "failed",
"user_balance": 100,
"user_id": "1234567"
}
]
[
{
"operation_id": 647287,
"transaction_id": 1234567,
"coupon_id": null,
"coupon_code": null,
"transaction_type": "invoice",
"comment": "Incoming payment",
"date": "2014-10-28T12:00:00+04:00",
"amount": 1000,
"sum": 10,
"currency": "USD",
"status": "notified",
"user_balance": 100,
"user_id": "1234567"
},
{
"operation_id": 647288,
"transaction_id": null,
"coupon_id": 12345,
"coupon_code": "DemoCoupon",
"transaction_type": "coupon",
"comment": "Coupon Redeem",
"date": "2014-10-28T14:00:00+04:00",
"amount": 0,
"sum": null,
"currency": null,
"status": "failed",
"user_balance": 100,
"user_id": "1234567"
}
]
残高の更新
ユーザーの残高を更新します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/recharge
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ゲーム内のユーザーのID。 |
int | float | 仮想通貨量。 |
comment | string | 残高を変更する理由。 |
リクエスト
<?php
$response = $xsollaClient->RechargeWalletUserBalance(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'request' => array(
'amount' => 10,
'comment' => 'Incoming payment'
)
));
POST /merchant/v2/projects/{project_id}/users/{user_id}/recharge HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"amount": 10,
"comment": "Incoming payment"
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/recharge' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"amount": 10,
"comment": "Incoming payment"
}'
レスポンス
<?php
// example response
$response = array (
'amount' => 110
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"amount": 110
}
{
"amount": 110
}
ユーザーの仮想アイテムの一覧表示
ユーザーが所有する仮想アイテムの一覧を取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/virtual_items
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ゲーム内のユーザーのID。 |
offset | int | 取得する最初のレコードのオフセット。 |
limit | int | 取得するレコードの最大数。 |
リクエスト
<?php
$response = $xsollaClient->ListWalletUserVirtualItems(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'limit' => 1,
'offset' => 0
));
GET /merchant/v2/projects/{project_id}/users/{user_id}/virtual_items?offset=1&limit=1 HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/virtual_items?offset=1&limit=1' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 1,
'sku' => 'item1',
'quantity' => 10
),
array (
'id' => 2,
'sku' => 'item2',
'quantity' => 5
),
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 1,
"sku": "item1",
"quantity":10
},
{
"id": 2,
"sku": "item2",
"quantity":5
}
]
[
{
"id": 1,
"sku": "item1",
"quantity":10
},
{
"id": 2,
"sku": "item2",
"quantity":5
}
]
すべてのユーザの仮想アイテムの一覧表示
すべてのプロジェクトのユーザーの仮想アイテムを取得。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/virtual_items/total
--------- | ---- | ----------- project_id | int | ゲームID。 user_id | string | ゲーム内のユーザーのID。 offset | int | 取得する最初のレコードのオフセット。 limit | int | 取得するレコードの最大数。
リクエスト
<?php
$response = $xsollaClient->ListWalletUserVirtualItems(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'limit' => 1,
'offset' => 0
));
GET /merchant/v2/projects/{project_id}/users/{user_id}/virtual_items?offset=1&limit=1 HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
Content-Type: application/json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/virtual_items?offset=1&limit=1' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'user_id' => 'V1',
'virtual_items' =>
array (
'id' => 1,
'sku' => 'item1',
'quantity' => '10'
),
array (
'id' => 2,
'sku' => 'item2',
'quantity' => '5'
),
),
array (
'user_id' => 'V2',
'virtual_items' =>
array (
'id' => 1,
'sku' => 'item1',
'quantity' => '9'
),
),
);
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"user_id": "V1",
"virtual_items": [
{
"id": 1,
"sku": "item1",
"quantity": 10
},
{
"id": 2,
"sku": "item2",
"quantity": 5
}
]
},
{
"user_id": "V2",
"virtual_items": [
{
"id": 1,
"sku": "item1",
"quantity": 9
}
]
}
]
[
{
"user_id": "V1",
"virtual_items": [
{
"id": 1,
"sku": "item1",
"quantity": 10
},
{
"id": 2,
"sku": "item2",
"quantity": 5
}
]
},
{
"user_id": "V2",
"virtual_items": [
{
"id": 1,
"sku": "item1",
"quantity": 9
}
]
}
]
ユーザに仮想アイテムを与える
仮想アイテムをユーザーのアカウントに追加します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/virtual_items/add
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ゲーム内のユーザーのID。 |
virtual_items | array | 仮想アイテム(配列)。 |
virtual_items.virtual_item | object | 仮想アイテムの詳細(オブジェクト)。 |
virtual_items.virtual_item.sku | string | 固有アイテムID。 |
virtual_items.amount | int | アイテム数量。 |
リクエスト
<?php
$response = $xsollaClient->AddVirtualItemToWalletUser(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'request' => array(
'virtual_items' => array(
array(
'virtual_item' => array(
'sku' => 'ar23_shop_expiration_3'
),
'amount' => 2
)
)
)
));
POST /merchant/v2/projects/{project_id}/users/{user_id}/virtual_items/add HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"virtual_items":[
{
"virtual_item":
{
"sku" : "ar23_shop_expiration_3"
},
"amount": 2
}
]
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/virtual_items/add' \
-X POST \
-u merchant_id:merchant_api_key
-d '{
"virtual_items":[
{
"virtual_item":
{
"sku" : "ar23_shop_expiration_3"
},
"amount": 2
}
]
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
ユーザーからアイテムを取り除く
ユーザーのアカウントから仮想アイテムを削除します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/virtual_items/remove
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
user_id | string | ゲーム内のユーザーのID。 |
virtual_items | array | 仮想アイテム(配列)。 |
virtual_items.virtual_item | object | 仮想アイテムの詳細(オブジェクト)。 |
virtual_items.virtual_item.sku | string | 固有アイテムID。 |
virtual_items.amount | int | アイテム数量。 |
リクエスト
<?php
$response = $xsollaClient->DeleteVirtualItemFromWalletUser(array(
'project_id' => PROJECT_ID,
'user_id' => USER_ID,
'request' => array(
'virtual_items' => array(
array(
'virtual_item' => array(
'sku' => 'ar23_shop_expiration_3'
),
'amount' => 2,
)
)
)
));
POST /merchant/v2/projects/{project_id}/users/{user_id}/virtual_items/remove HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"virtual_items":[
{
"virtual_item":
{
"sku" : "ar23_shop_expiration_3"
},
"amount": 2
}
]
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/virtual_items/remove' \
-X POST \
-u merchant_id:merchant_api_key
-d '{
"virtual_items":[
{
"virtual_item":
{
"sku" : "ar23_shop_expiration_3"
},
"amount": 2
}
]
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
ゲーム配信エンティティの作成
ゲーム配信エンティティを作成する
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 |
sku | string | ゲーム配信エンティティの固有ID。SKUには、小文字のラテン文字、数字、ダッシュ、アンダースコアのみを含めることができます。 |
name | object | ゲーム配信エンティティのローカライズされた名前の配列。 |
description | object | ゲーム配信エンティティのローカライズされた説明の配列。 |
system_requirements | string | ゲームのシステム要件。 |
image_url | string | 画像URL。 任意。 |
long_description | string | ゲーム配信エンティティの詳細説明。 任意。 |
locales_list | string | カンマ区切りのローカリゼーションの一覧。 任意。 |
publisher | string | ゲーム出版社。 任意。 |
developer | string | ゲーム開発者。 任意。 |
video_link | string | ゲームを特集したビデオへのリンク。 任意。 |
genre | string | ゲームのジャンル。 任意。 |
additional_info | string | ゲームに関する追加情報。 任意。 |
forum_link | string | ディスカッションフォーラムへのリンク。 任意。 |
support_link | string | サポートページへのリンク。 任意。 |
old_price | string | ゲームの古い価格。 任意。 |
parent_id | int | 親ゲームのID。任意。 |
default_currency | string | 既定の通貨。ISO 4217 3文字通貨コード。 |
release_date | string | リリース予定日。 任意。 |
drm | array | DRMデータを含む配列。 |
drm.id | int | 利用可能なDRMのID。 |
drm.prices | array | DRMのゲーム価格の配列。 任意。 |
drm.platforms | array | DRMプラットフォームに関するデータを含む配列。 |
drm.platforms.id | int | そのDRMのプラットフォームID。 |
drm.enabled | boolean | DRMがこのゲームで使用されているかどうかを示します。 |
obtain_code_from_db | boolean | XsollaデータベースのPINコードを使用するかどうかを示します。 任意。 |
obtain_code_from_api | boolean | API経由で受信したPINコードを使用するかどうかを示します。 任意。 |
リクエスト
<?php
$response = $xsollaClient->CreateGameDeliveryEntity(array(
'project_id' => PROJECT_ID,
'request' => array (
'sku' => 'GTA5',
'name' =>
array (
'en' => 'GTA V',
),
'description' =>
array (
'en' => 'Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games.',
),
'system_requirements' => 'OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)',
'image_url' => '//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png',
'long_description' => NULL,
'locales_list' => NULL,
'publisher' => NULL,
'developer' => NULL,
'video_link' => NULL,
'genre' => NULL,
'additional_info' => NULL,
'forum_link' => NULL,
'support_link' => NULL,
'old_price' => NULL,
'parent_id' => NULL,
'default_currency' => 'EUR',
'release_date' => '2016-01-01T00:00:00+00:00',
'drm' =>
array (
array (
'id' => 1,
'platforms' =>
array (
array (
'id' => 1,
),
array (
'id' => 2,
),
),
'prices' =>
array (
'USD' => 19.99,
'EUR' => 18.5,
),
'enabled' => true
),
),
'obtain_code_from_api' => false,
'obtain_code_from_db' => false,
)
));
POST /merchant/v2/projects/{project_id}/game_delivery HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"sku":"GTA5",
"name":{
"en":"GTA V"
},
"description":{
"en":"Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games."
},
"system_requirements":"OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)",
"image_url":"//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png",
"long_description":null,
"locales_list":null,
"publisher":null,
"developer":null,
"video_link":null,
"genre":null,
"additional_info":null,
"forum_link":null,
"support_link":null,
"old_price":null,
"parent_id":null,
"default_currency":"EUR",
"release_date":"2016-01-01T00:00:00+00:00",
"drm":[
{
"id":1,
"platforms":[
{
"id":1
},
{
"id":2
}
],
"prices":{
"USD":19.99,
"EUR":18.5
},
"enabled":true
}
],
"obtain_code_from_api":false,
"obtain_code_from_db":false
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"sku":"GTA5",
"name":{
"en":"GTA V"
},
"description":{
"en":"Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games."
},
"system_requirements":"OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)",
"image_url":"//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png",
"long_description":null,
"locales_list":null,
"publisher":null,
"developer":null,
"video_link":null,
"genre":null,
"additional_info":null,
"forum_link":null,
"support_link":null,
"old_price":null,
"parent_id":null,
"default_currency":"EUR",
"release_date":"2016-01-01T00:00:00+00:00",
"drm":[
{
"id":1,
"platforms":[
{
"id":1
},
{
"id":2
}
],
"prices":{
"USD":19.99,
"EUR":18.5
},
"enabled":true
}
],
"obtain_code_from_api":false,
"obtain_code_from_db":false
}'
レスポンス
<?php
// example response
$response = array (
'id' => 77
);
HTTP/1.1 201 Created
コンテンツタイプ:application / json
{
"id": 77
}
{
"id": 77
}
ゲーム配信エンティティの取得
ゲーム配信エンティティを取得する。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery/{game_delivery_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 |
game_delivery_id | int | ゲーム配信エンティティのID。 |
リクエスト
<?php
$response = $xsollaClient->GetGameDeliveryEntity(array(
'project_id' => PROJECT_ID,
'game_delivery_id' => GAME_DELIVERY_ID
));
GET /merchant/v2/projects/{project_id}/game_delivery/{game_delivery_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery/{game_delivery_id}' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
'id' => 9,
'sku' => 'GTA5',
'name' =>
array (
'en' => 'GTA V',
),
'description' =>
array (
'en' => 'Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games.',
),
'system_requirements' => 'OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)',
'image_url' => '//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png',
'long_description' => NULL,
'locales_list' => NULL,
'publisher' => NULL,
'developer' => NULL,
'video_link' => NULL,
'genre' => NULL,
'additional_info' => NULL,
'forum_link' => NULL,
'support_link' => NULL,
'old_price' => NULL,
'parent_id' => NULL,
'default_currency' => 'EUR',
'release_date' => '2016-01-01T00:00:00+00:00',
'drm' =>
array (
array (
'id' => 1,
'name' => 'Steam',
'image' => NULL,
'platforms' =>
array (
array (
'id' => 1,
'name' => 'Windows',
),
array (
'id' => 2,
'name' => 'Linux',
),
),
'prices' =>
array (
'USD' => 19.99,
'EUR' => 18.5,
),
'codes' =>
array (
'total' => 0,
'active' => 0,
'used' => 0,
),
),
),
'obtain_code_from_api' => false,
'obtain_code_from_db' => false,
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"id": 9,
"sku": "GTA5",
"name":{
"en": "GTA V"
},
"description":{
"en": "Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games."
},
"system_requirements": "OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)",
"image_url": "//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png",
"long_description": null,
"locales_list": null,
"publisher": null,
"developer": null,
"video_link": null,
"genre": null,
"additional_info": null,
"forum_link": null,
"support_link": null,
"old_price": null,
"parent_id": null,
"default_currency": "EUR",
"release_date": "2016-01-01T00:00:00+00:00",
"drm":[
{
"id": 1,
"name": "Steam",
"image": null,
"platforms":[
{
"id": 1,
"name": "Windows"
},
{
"id": 2,
"name": "Linux"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 0,
"active": 0,
"used": 0
}
},
{
"id": 2,
"name": "Playstation",
"image": null,
"platforms":[
{
"id": 3,
"name": "Playstation 3"
},
{
"id": 4,
"name": "Playstation 4"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 0,
"active": 0,
"used": 0
}
}
],
"obtain_code_from_api": false,
"obtain_code_from_db": false
}
{
"id": 9,
"sku": "GTA5",
"name":{
"en": "GTA V"
},
"description":{
"en": "Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games."
},
"system_requirements": "OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)",
"image_url": "//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png",
"long_description": null,
"locales_list": null,
"publisher": null,
"developer": null,
"video_link": null,
"genre": null,
"additional_info": null,
"forum_link": null,
"support_link": null,
"old_price": null,
"parent_id": null,
"default_currency": "EUR",
"release_date": "2016-01-01T00:00:00+00:00",
"drm":[
{
"id": 1,
"name": "Steam",
"image": null,
"platforms":[
{
"id": 1,
"name": "Windows"
},
{
"id": 2,
"name": "Linux"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 0,
"active": 0,
"used": 0
}
},
{
"id": 2,
"name": "Playstation",
"image": null,
"platforms":[
{
"id": 3,
"name": "Playstation 3"
},
{
"id": 4,
"name": "Playstation 4"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 0,
"active": 0,
"used": 0
}
}
],
"obtain_code_from_api": false,
"obtain_code_from_db": false
}
ゲーム配信エンティティの更新
ゲーム配信エンティティを更新します。
HTTPリクエスト
PUT https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery/{game_delivery_id}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 |
game_delivery_id | int | ゲーム配信エンティティのID。 |
sku | string | ゲーム配信エンティティの固有ID。SKUには、小文字のラテン文字、数字、ダッシュ、アンダースコアのみを含めることができます。 |
name | object | ゲーム配信エンティティのローカライズされた名前の配列。 |
description | object | ゲーム配信エンティティのローカライズされた説明の配列。 |
system_requirements | string | ゲームのシステム要件。 |
image_url | string | 画像URL。 任意。 |
long_description | string | ゲーム配信エンティティの詳細説明。 任意。 |
locales_list | string | カンマ区切りのローカリゼーションの一覧。 任意。 |
publisher | string | ゲーム出版社。 任意。 |
developer | string | ゲーム開発者。 任意。 |
video_link | string | ゲームを特集したビデオへのリンク。 任意。 |
genre | string | ゲームのジャンル。 任意。 |
additional_info | string | ゲームに関する追加情報。 任意。 |
forum_link | string | ディスカッションフォーラムへのリンク。 任意。 |
support_link | string | サポートページへのリンク。 任意。 |
old_price | string | ゲームの古い価格。 任意。 |
parent_id | int | 親ゲームのID。任意。 |
default_currency | string | 既定の通貨。ISO 4217 3文字通貨コード。 |
release_date | string | リリース予定日。 任意。 |
drm | array | DRMデータを含む配列。 |
drm.id | int | 利用可能なDRMのID。 |
drm.prices | array | DRMのゲーム価格の配列。 任意。 |
drm.platforms | array | DRMプラットフォームに関するデータを含む配列。 |
drm.platforms.id | int | そのDRMのプラットフォームID。 |
drm.enabled | boolean | DRMがこのゲームで使用されているかどうかを示します。 |
obtain_code_from_db | boolean | XsollaデータベースのPINコードを使用するかどうかを示します。 任意。 |
obtain_code_from_api | boolean | API経由で受信したPINコードを使用するかどうかを示します。 任意。 |
リクエスト
<?php
$response = $xsollaClient->UpdateGameDeliveryEntity(array(
'project_id' => PROJECT_ID,
'game_delivery_id' => GAME_DELIVERY_ID
'request' => array (
'sku' => 'GTA5',
'name' =>
array (
'en' => 'GTA V',
),
'description' =>
array (
'en' => 'Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games.',
),
'system_requirements' => 'OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)',
'image_url' => '//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png',
'long_description' => NULL,
'locales_list' => NULL,
'publisher' => NULL,
'developer' => NULL,
'video_link' => NULL,
'genre' => NULL,
'additional_info' => NULL,
'forum_link' => NULL,
'support_link' => NULL,
'old_price' => NULL,
'parent_id' => NULL,
'default_currency' => 'EUR',
'release_date' => '2016-01-01T00:00:00+00:00',
'drm' =>
array (
array (
'id' => 1,
'platforms' =>
array (
array (
'id' => 1,
),
array (
'id' => 2,
),
),
'prices' =>
array (
'USD' => 19.99,
'EUR' => 18.5,
),
'enabled' => true
),
),
'obtain_code_from_api' => false,
'obtain_code_from_db' => false,
)
));
PUT /merchant/v2/projects/{project_id}/game_delivery/{game_delivery_id} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"sku":"GTA5",
"name":{
"en":"GTA V"
},
"description":{
"en":"Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games."
},
"system_requirements":"OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)",
"image_url":"//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png",
"long_description":null,
"locales_list":null,
"publisher":null,
"developer":null,
"video_link":null,
"genre":null,
"additional_info":null,
"forum_link":null,
"support_link":null,
"old_price":null,
"parent_id":null,
"default_currency":"EUR",
"release_date":"2016-01-01T00:00:00+00:00",
"drm":[
{
"id":1,
"platforms":[
{
"id":1
},
{
"id":2
}
],
"prices":{
"USD":19.99,
"EUR":18.5
},
"enabled":true
}
],
"obtain_code_from_api":false,
"obtain_code_from_db":false
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery/{game_delivery_id}' \
-X PUT \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"sku":"GTA5",
"name":{
"en":"GTA V"
},
"description":{
"en":"Grand Theft Auto V is an open world, action-adventure video game developed by Rockstar North and published by Rockstar Games."
},
"system_requirements":"OS: Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)",
"image_url":"//cdn2.xsolla.com/img/misc/merchant/v2/default-item.png",
"long_description":null,
"locales_list":null,
"publisher":null,
"developer":null,
"video_link":null,
"genre":null,
"additional_info":null,
"forum_link":null,
"support_link":null,
"old_price":null,
"parent_id":null,
"default_currency":"EUR",
"release_date":"2016-01-01T00:00:00+00:00",
"drm":[
{
"id":1,
"platforms":[
{
"id":1
},
{
"id":2
}
],
"prices":{
"USD":19.99,
"EUR":18.5
},
"enabled":true
}
],
"obtain_code_from_api":false,
"obtain_code_from_db":false
}'
レスポンス
<?php
$response = null;
HTTP/1.1 204 No Content
ゲーム配信エンティティの一覧
すべてのゲーム配信エンティティを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | プロジェクトID。 |
リクエスト
<?php
$response = $xsollaClient->ListGameDeliveryEntities(array(
'project_id' => PROJECT_ID
));
GET /merchant/v2/projects/{project_id}/game_delivery HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/game_delivery' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
array (
array (
'id' => 9,
'localized_name' => 'GTA V',
'parent_id' => NULL,
'default_currency' => 'EUR',
'drm' =>
array (
array (
'id' => 1,
'name' => 'Steam',
'image' => NULL,
'platforms' =>
array (
array (
'id' => 1,
'name' => 'Windows',
),
array (
'id' => 2,
'name' => 'Linux',
),
),
'prices' =>
array (
'USD' => 19.99,
'EUR' => 18.5,
),
'codes' =>
array (
'total' => 1000,
'active' => 999,
'used' => 1,
),
),
array (
'id' => 2,
'name' => 'Playstation',
'image' => NULL,
'platforms' =>
array (
array (
'id' => 3,
'name' => 'Playstation 3',
),
array (
'id' => 4,
'name' => 'Playstation 4',
),
),
'prices' =>
array (
'USD' => 19.99,
'EUR' => 18.5,
),
'codes' =>
array (
'total' => 1000,
'active' => 999,
'used' => 1,
),
),
),
),
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
[
{
"id": 9,
"localized_name": "GTA V",
"parent_id": null,
"default_currency": "EUR",
"drm":[
{
"id": 1,
"name": "Steam",
"image": null,
"platforms":[
{
"id": 1,
"name": "Windows"
},
{
"id": 2,
"name": "Linux"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 1000,
"active": 999,
"used": 1
}
},
{
"id": 2,
"name": "Playstation",
"image": null,
"platforms":[
{
"id": 3,
"name": "Playstation 3"
},
{
"id": 4,
"name": "Playstation 4"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 1000,
"active": 999,
"used": 1
}
}
]
}
]
[
{
"id": 9,
"localized_name": "GTA V",
"parent_id": null,
"default_currency": "EUR",
"drm":[
{
"id": 1,
"name": "Steam",
"image": null,
"platforms":[
{
"id": 1,
"name": "Windows"
},
{
"id": 2,
"name": "Linux"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 1000,
"active": 999,
"used": 1
}
},
{
"id": 2,
"name": "Playstation",
"image": null,
"platforms":[
{
"id": 3,
"name": "Playstation 3"
},
{
"id": 4,
"name": "Playstation 4"
}
],
"prices":{
"USD": 19.99,
"EUR": 18.5
},
"codes":{
"total": 1000,
"active": 999,
"used": 1
}
}
]
}
]
DRMの一覧
利用可能なDRMプラットフォームを一覧表示します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/drm
パラメータ | 種類 | 説明 |
---|---|---|
merchant_id | int | マーチャントID。 |
リクエスト
<?php
$response = $xsollaClient->ListGameDeliveryDrmPlatforms();
GET /merchant/v2/merchants/{merchant_id}/drm HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/drm' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'drm' =>
array (
array (
'id' => 1,
'name' => 'Steam',
'image' => '//cdn2.xsolla.com/misc/game_delivery/drms/set2/1.1450132085.svg',
'platforms' =>
array (
array (
'id' => 1,
'name' => 'Windows',
),
array (
'id' => 2,
'name' => 'Linux',
),
array (
'id' => 6,
'name' => 'Mac',
),
),
),
array (
'id' => 2,
'name' => 'Playstation',
'image' => '//cdn2.xsolla.com/misc/game_delivery/drms/set2/2.1449183647.svg',
'platforms' =>
array (
array (
'id' => 3,
'name' => 'Playstation 3',
),
array (
'id' => 4,
'name' => 'Playstation 4',
),
),
),
array (
'id' => 3,
'name' => 'XBox',
'image' => '//cdn2.xsolla.com/misc/game_delivery/drms/set2/3.1449183647.svg',
'platforms' =>
array (
array (
'id' => 5,
'name' => 'XBox One',
),
array (
'id' => 7,
'name' => 'XBox 360',
),
),
),
array (
'id' => 4,
'name' => 'Uplay',
'image' => '//cdn2.xsolla.com/misc/game_delivery/drms/set2/4.1450201713.svg',
'platforms' =>
array (
array (
'id' => 1,
'name' => 'Windows',
),
array (
'id' => 2,
'name' => 'Linux',
),
array (
'id' => 6,
'name' => 'Mac',
),
),
),
array (
'id' => 5,
'name' => 'Origin',
'image' => '//cdn2.xsolla.com/misc/game_delivery/drms/set2/5.1450201747.svg',
'platforms' =>
array (
array (
'id' => 1,
'name' => 'Windows',
),
array (
'id' => 2,
'name' => 'Linux',
),
array (
'id' => 6,
'name' => 'Mac',
),
),
),
array (
'id' => 6,
'name' => 'DRM Free',
'image' => '//cdn2.xsolla.com/misc/game_delivery/drms/set2/6.1450201849.svg',
'platforms' =>
array (
array (
'id' => 1,
'name' => 'Windows',
),
array (
'id' => 2,
'name' => 'Linux',
),
array (
'id' => 6,
'name' => 'Mac',
),
)
)
),
'platforms' =>
array (
array (
'id' => 1,
'name' => 'Windows',
),
array (
'id' => 2,
'name' => 'Linux',
),
array (
'id' => 3,
'name' => 'Playstation 3',
),
array (
'id' => 4,
'name' => 'Playstation 4',
),
array (
'id' => 5,
'name' => 'XBox One',
),
array (
'id' => 6,
'name' => 'Mac',
),
array (
'id' => 7,
'name' => 'XBox 360',
)
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"drm":[
{
"id":1,
"name":"Steam",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/1.1450132085.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
},
{
"id":2,
"name":"Playstation",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/2.1449183647.svg",
"platforms":[
{
"id":3,
"name":"Playstation 3"
},
{
"id":4,
"name":"Playstation 4"
}
]
},
{
"id":3,
"name":"XBox",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/3.1449183647.svg",
"platforms":[
{
"id":5,
"name":"XBox One"
},
{
"id":7,
"name":"XBox 360"
}
]
},
{
"id":4,
"name":"Uplay",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/4.1450201713.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
},
{
"id":5,
"name":"Origin",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/5.1450201747.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
},
{
"id":6,
"name":"DRM Free",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/6.1450201849.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
}
],
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":3,
"name":"Playstation 3"
},
{
"id":4,
"name":"Playstation 4"
},
{
"id":5,
"name":"XBox One"
},
{
"id":6,
"name":"Mac"
},
{
"id":7,
"name":"XBox 360"
}
]
}
{
"drm":[
{
"id":1,
"name":"Steam",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/1.1450132085.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
},
{
"id":2,
"name":"Playstation",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/2.1449183647.svg",
"platforms":[
{
"id":3,
"name":"Playstation 3"
},
{
"id":4,
"name":"Playstation 4"
}
]
},
{
"id":3,
"name":"XBox",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/3.1449183647.svg",
"platforms":[
{
"id":5,
"name":"XBox One"
},
{
"id":7,
"name":"XBox 360"
}
]
},
{
"id":4,
"name":"Uplay",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/4.1450201713.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
},
{
"id":5,
"name":"Origin",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/5.1450201747.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
},
{
"id":6,
"name":"DRM Free",
"image":"//cdn2.xsolla.com/misc/game_delivery/drms/set2/6.1450201849.svg",
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":6,
"name":"Mac"
}
]
}
],
"platforms":[
{
"id":1,
"name":"Windows"
},
{
"id":2,
"name":"Linux"
},
{
"id":3,
"name":"Playstation 3"
},
{
"id":4,
"name":"Playstation 4"
},
{
"id":5,
"name":"XBox One"
},
{
"id":6,
"name":"Mac"
},
{
"id":7,
"name":"XBox 360"
}
]
}
クーポンの取得
クーポンの詳細をコードで入手してください。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
code | string | クーポンコード。 |
リクエスト
<?php
$response = $xsollaClient->GetCoupon(array(
'project_id' => PROJECT_ID,
'code' => COUPON_CODE
));
GET /merchant/v2/projects/{project_id}/coupons/{code} HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}' \
-X GET \
-u merchant_id:merchant_api_key
レスポンス
<?php
// example response
$response = array (
'coupon_id' => 1,
'project_id' => 1,
'coupon_code' => 'CouPoNCoDe',
'campaign_code' => 'CaMPaiGNCoDe',
'virtual_currency_amount' => 0,
'is_active' => 1,
'redeems_count_remain' => 1,
'redeems_count_for_user' => null,
'expiration_date' => '2014-10-16 21:44:31',
'virtual_items' =>
array (
'virtual_item' =>
array (
'id' => 77,
'sku' => 'T-43-3-unique-id',
'item_code' => null,
'advertisement_type' => null,
'name' =>
array (
'en' => 'T-34-3',
),
'description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.',
),
'long_description' =>
array (
),
'prices' =>
array (
'USD' => 40.09,
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'purchase_limit' => 1,
'keywords' =>
array (
),
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'groups' =>
array (25),
'item_type' => 'Expiration',
'expiration' => 1296000,
'virtual_currency_price' => null,
),
'amount' => 1
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"coupon_id": 1,
"project_id": 1,
"coupon_code": "CouPoNCoDe",
"campaign_code": "CaMPaiGNCoDe",
"virtual_currency_amount": 0,
"is_active": 1,
"redeems_count_remain": 1,
"redeems_count_for_user": null,
"expiration_date": "2014-10-16 21:44:31",
"virtual_items":{
"virtual_item":{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"advertisement_type": null,
"name":{
"en": "T-34-3"
},
"description":{
"en": "This Chinese Tier VIII medium tank is a real beast in its class."
},
"long_description":[],
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"purchase_limit": 1,
"keywords":[],
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"groups":[
25
],
"item_type": "Expiration",
"expiration": 1296000,
"virtual_currency_price": null,
"item_code": null
},
"amount": 1
}
}
{
"coupon_id": 1,
"project_id": 1,
"coupon_code": "CouPoNCoDe",
"campaign_code": "CaMPaiGNCoDe",
"virtual_currency_amount": 0,
"is_active": 1,
"redeems_count_remain": 1,
"redeems_count_for_user": null,
"expiration_date": "2014-10-16 21:44:31",
"virtual_items":{
"virtual_item":{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"advertisement_type": null,
"name":{
"en": "T-34-3"
},
"description":{
"en": "This Chinese Tier VIII medium tank is a real beast in its class."
},
"long_description":[],
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"purchase_limit": 1,
"keywords":[],
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"groups":[
25
],
"item_type": "Expiration",
"expiration": 1296000,
"virtual_currency_price": null,
"item_code": null
},
"amount": 1
}
}
クーポンの償還
クーポンをコードで償還してください。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem
パラメータ | 種類 | 説明 |
---|---|---|
project_id | int | ゲームID。 |
code | string | クーポンコード。 |
user_id | string | ゲーム内のユーザーのID。 |
リクエスト
<?php
$response = $xsollaClient->RedeemCoupon(array(
'project_id' => PROJECT_ID,
'code' => COUPON_CODE,
'request' => array(
'user_id' => 1
)
));
POST /merchant/v2/projects/{project_id}/coupons/{code}/redeem HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"user_id": 1
}
$ curl -v 'https://api.xsolla.com/merchant/v2/projects/{project_id}/coupons/{code}/redeem' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"user_id": 1
}'
レスポンス
<?php
// example response
$response = array (
'coupon_id' => 1,
'project_id' => 1,
'coupon_code' => 'CouPoNCoDe',
'campaign_code' => 'CaMPaiGNCoDe',
'virtual_currency_amount' => 0,
'is_active' => 1,
'redeems_count_remain' => 1,
'redeems_count_for_user' => null,
'expiration_date' => '2014-10-16 21:44:31',
'virtual_items' =>
array (
'virtual_item' =>
array (
'id' => 77,
'sku' => 'T-43-3-unique-id',
'item_code' => null,
'advertisement_type' => null,
'name' =>
array (
'en' => 'T-34-3',
),
'description' =>
array (
'en' => 'This Chinese Tier VIII medium tank is a real beast in its class.',
),
'long_description' =>
array (
),
'prices' =>
array (
'USD' => 40.09,
),
'default_currency' => 'USD',
'enabled' => true,
'permanent' => false,
'purchase_limit' => 1,
'keywords' =>
array (
),
'image_url' => 'http://livedemo.xsolla.com/airplanes/tank5.jpg',
'groups' =>
array (25),
'item_type' => 'Expiration',
'expiration' => 1296000,
'virtual_currency_price' => null,
),
'amount' => 1
)
);
HTTP/1.1 200 OK
コンテンツタイプ:application / json
{
"coupon_id": 1,
"project_id": 1,
"coupon_code": "CouPoNCoDe",
"campaign_code": "CaMPaiGNCoDe",
"virtual_currency_amount": 0,
"is_active": 1,
"redeems_count_remain": 1,
"redeems_count_for_user": null,
"expiration_date": "2014-10-16 21:44:31",
"virtual_items":{
"virtual_item":{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"advertisement_type": null,
"name":{
"en": "T-34-3"
},
"description":{
"en": "This Chinese Tier VIII medium tank is a real beast in its class."
},
"long_description":[],
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"purchase_limit": 1,
"keywords":[],
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"groups":[
25
],
"item_type": "Expiration",
"expiration": 1296000,
"virtual_currency_price": null,
"item_code": null
},
"amount": 1
}
}
{
"coupon_id": 1,
"project_id": 1,
"coupon_code": "CouPoNCoDe",
"campaign_code": "CaMPaiGNCoDe",
"virtual_currency_amount": 0,
"is_active": 1,
"redeems_count_remain": 1,
"redeems_count_for_user": null,
"expiration_date": "2014-10-16 21:44:31",
"virtual_items":{
"virtual_item":{
"id": 77,
"sku": "T-43-3-unique-id",
"item_code": "chinese-medium-tank",
"advertisement_type": null,
"name":{
"en": "T-34-3"
},
"description":{
"en": "This Chinese Tier VIII medium tank is a real beast in its class."
},
"long_description":[],
"prices":{
"USD": 40.09
},
"default_currency": "USD",
"enabled": true,
"permanent": false,
"purchase_limit": 1,
"keywords":[],
"image_url": "http:\/\/livedemo.xsolla.com\/airplanes\/tank5.jpg",
"groups":[
25
],
"item_type": "Expiration",
"expiration": 1296000,
"virtual_currency_price": null,
"item_code": null
},
"amount": 1
}
}
プロモーションの作成
新しいプロモーションを作成します。
HTTPリクエスト
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions
パラメータ | 種類 | 説明 |
---|---|---|
merchant_id | int | マーチャントID。 |
technical_name | string | プロモーションの名称。 |
label | array of strings | 決済インターフェースに表示するローカライズされたラベルの配列。 |
name | array of strings | ローカライズされたプロモーション名の配列。 |
description | array of strings | ローカライズされたプロモーション記述の配列。 |
project_id | int | プロモーションが適用されるゲームのID。 |
リクエスト
<?php
$response = $xsollaClient->CreatePromotion(array(
'request' => array (
'technical_name' => 'Sample Promotion',
'label' =>
array (
'en' => '30% SAVE',
),
'name' =>
array (
'en' => '30% PayPal Discount',
),
'description' =>
array (
'en' => '30% PayPal Discount Sample',
),
'project_id' => 1,
)
));
POST /merchant/v2/merchants/{merchant_id}/promotions HTTP/1.1
User-Agent: xsolla-api-client/1.0
Host: api.xsolla.com
Accept: application/json
Authorization: Basic ZGVtb0B4c29sbGEuY29tOmRlbW8=
コンテンツタイプ:application / json
{
"technical_name": "Sample Promotion",
"label":{
"en": "30% SAVE"
},
"name":{
"en": "30% PayPal Discount"
},
"description":{
"en": "30% PayPal Discount Sample"
},
"project_id": 1
}
$ curl -v 'https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions' \
-X POST \
-u merchant_id:merchant_api_key \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"technical_name": "Sample Promotion",
"label":{
"en": "30% SAVE"
},
"name":{
"en": "30% PayPal Discount"
},
"description":{
"en": "30% PayPal Discount Sample"
},
"project_id": 1
}'
レスポンス
<?php
// example response
$response = array (
'id' => 1
);
HTTP/1.1 201 Created
{
"id": 1
}
{
"id": 1
}
プロモーションの取得
プロモーションを取得します。
HTTPリクエスト
GET https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/promotions/{promotion_id}
パラメータ | 種類 | 説明 |
---|