概要
このセクションでは、決済ステーションの操作方法について説明します。基本認証を利用して、メソッドを呼び出します。ストアUIを開いて安全な支払いを有効にするには、まずtokenを取得する必要があります。
エンドポイントのパス:https://api.xsolla.com
。
決済ステーションを開く
決済ステーションは、ユーザーがウェブサイト上でゲームやアイテムを購入できるようにする完全な決済UIです。ウェブサイトに決済UIを簡単に実装するには、当社のCDNからスクリプトをダウンロードしてください。このURLを使用して、あなたのウェブサイトにスクリプトを統合します。詳細については、GitHub リポジトリをご覧ください。
スクリプト初期化パラメータ:
パラメータ | 種類 | 説明文 |
---|---|---|
access_token | string | APIから受信したトークン。 必須。 |
sandbox | boolean | 決済処理をテストするには、trueに設定します:sandbox-secure.xsolla.comがsecure.xsolla.com用されます。 |
lightbox | object | ライトボックスパラメータ(オブジェクト、デスクトップバージョンのみ)。 |
lightbox.width | string | ライトボックスのフレーム幅。nullの場合、決済ステーションの幅に依存します。既定はnullです。 |
lightbox.height | string | ライトボックスのフレームの高さ。nullの場合、決済ステーションの高さに依存します。既定は100% です。 |
lightbox.zIndex | integer | 配置順序を定義します。既定は1000です。 |
lightbox.overlayOpacity | integer | オーバーレイ不透明度(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 。これらの色の変更は、決済ステーション iframe自体には影響を与えず、それを保持するライトボックスの設定のみに影響を与えることに注意してください。 |
lightbox.contentMargin | string | フレームマージン。既定は10px です。 |
lightbox.spinner | string | ローディングアニメーションのインジケータの種類。xsolla またはround に指定できます。既定はxsolla です。 |
lightbox.spinnerColor | string | スピナーの色。既定値はありません。 |
childWindow | object | 決済ステーションUIを含む子ウィンドウのオプション。モバイル版でサポートされています。 |
childWindow.target | string | 決済ステーションウィンドウを開く場所。_blank 、_self 、_parent に指定できます。既定は_blank です。 |
このスクリプトでは、決済インターフェースのイベントを追跡することができます。イベントの種類に応じて、Webページでさまざまな操作を実行できます。
イベントの一覧:
パラメータ | 説明文 |
---|---|
init | ウィジェットが初期化されました。 |
open | ウィジェットが開かれました。 |
load | 決済インターフェース(決済ステーション)が読み込まれました。 |
close | 決済インターフェース(決済ステーション)が閉じられています。 |
status | ユーザーはステータスページにいます。 |
status-invoice | ユーザーはステータスページにいます。支払いが進行中です。 |
status-delivering | ユーザーはステータスページにいます。支払いが完了しました。支払い通知が送信されました。 |
status-done | ユーザーはステータスページにいます。支払いはユーザーのアカウントに振り込まれます。 |
status-troubled | ユーザーはステータスページにいます。支払いに失敗しました。 |
自分で決済UIのオープニングを初期化したい場合は、こちらのリンクを利用してください:https://secure.xsolla.com/paystation3/?access_token=ACCESS_TOKEN。
テストを試したいときは次のURLをご使用くださいhttps://sandbox-secure.xsolla.com/paystation3/?access_token=ACCESS_TOKEN
。
トークン
決済をより安全に行うために、エクソラAPIは、決済ページで直接HTTP GETリクエストを使用してデータを受け取る代わりに、決済パラメータの一覧を含むトークンを使用します。決済ページを呼び出す前に、新しいトークンを取得する必要があります。トークンの有効期間は24時間です。
トークンの取得
エクソラは任意のユーザーパラメータでトークンを作成しますこれらのパラメータを送信すると、決済後に当社がこれらのパラメータを受信します。トークンにはすべてのユーザーパラメータが含まれます。
HTTPリクエスト
- http
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token
パラメータ | 種類 | 説明文 |
---|---|---|
user | object | ユーザーの詳細(オブジェクト)。 |
user.id | object | ユーザーID。 必須。 |
user.id.value | string | ユーザーID。 |
user.name | object | ユーザーのニックネームに関するデータを含むオブジェクト。 |
user.name.value | string | ユーザーのスクリーン名。 |
user.age | integer | ユーザーの年齢。 |
user.email | object | ユーザーのメール(オブジェクト)。このuser.emailオブジェクトは、不正対策モデルの構築と支払処理に不可欠な部分です。これは、エクソラと決済システムの両方の要件です。このパラメーターがないと、受入率が低下する可能性があります。 必須。 |
user.email.value | string | ユーザーのメールアドレス。RFC 822 で規定された書式を厳密に守らなければなりません。 必須。 |
user.phone | object | ユーザーの電話番号(オブジェクト)。 |
user.phone.value | string | ユーザーの電話番号。 |
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 | キャンペーンのコンテンツ。 |
user.is_legal | boolean | ユーザーが法人かを示します。 |
user.legal | object | 法人情報を含むオブジェクトです。user.is_legalがtrue の場合は、オブジェクトとその全パラメーターが必要です。 |
user.legal.name | string | 法人のフルネームです。 |
user.legal.address | string | 最後まで記載した法的住所です。 |
user.legal.vat_id | string | 納税者個別のID。 |
user.legal.country | string | 法人の国。ISO 3166-1 alpha-2に従って大文字2文字の国コードを使用します。 |
settings | object | カスタムプロジェクト設定(オブジェクト)。 |
settings.external_id | string | トランザクションの外部ID。 |
settings.project_id | integer | ゲームのエクソラID。パブリッシャ―アカウントにあります。 必須。 |
settings.language | string | インターフェース言語。2文字の小文字言語コード。 |
settings.return_url | string | ページを使用して決済後にユーザーをリダイレクトします。パラメータuser_id 、foreigninvoice 、invoice_id とstatus は、自動的にリンクに追加されます。 |
settings.redirect_policy | object | リダイレクトポリシーの設定(オブジェクト)。 |
settings.redirect_policy.redirect_conditions | string | ユーザーがリターンURLにリダイレクトされる決済状態。none 、successful 、successful_or_canceled 、またはany のいずれかとなります。 |
settings.redirect_policy.delay | integer | ユーザーがリターンURLに自動的にリダイレクトされるまでの遅延時間(秒)。 |
settings.redirect_policy.status_for_manual_redirection | string | リターンURLへのリダイレクトボタンが表示される決済状態。none 、successful 、successful_or_canceled 、またはany のいずれかとなります。 |
settings.redirect_policy.redirect_button_caption | string | 手動リダイレクト用のボタンのテキスト。 |
settings.currency | string | 標準の決済通貨。ISO 42173文字通貨コード。 |
settings.mode | string | 決済処理をテストするには、sandbox に設定します。この場合、https://sandbox-secure.xsolla.com を使用してテスト決済インターフェースにアクセスしてください。 |
settings.payment_method | integer | 決済方法のID。 |
settings.payment_widget | string | 決済ウィジェット。paybycash またはgiftcard が利用できます。パラメータが設定されている場合、ユーザーはそれぞれPay by CashまたはGift Cardsウィジェットにリダイレクトされます。 |
settings.ui | object | インタフェース設定(オブジェクト)。 |
settings.ui.theme | string | 決済インターフェースのテーマ。default (既定)または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.visible_purchase | boolean | ヘッダーに購入説明(purchase.description.value )を表示するか示します。デフォルトはtrue です。 |
settings.ui.desktop.header.type | string | ヘッダーを表示する方法。compact (プロジェクト名とユーザーIDを隠す)またはnormal (既定)に指定できます。 |
settings.ui.desktop.header.close_button | boolean | デスクトップ版決済ステーションに閉じるボタンを表示する設定。このボタンは決済ステーションを閉じて、settings.return_url パラメーターで指定されたURLにユーザーをリダイレクトします。デフォルトはfalse です。 |
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_item_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 | integer | メニュー内のサブメニューの位置。 |
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 | integer | メニュー内のサブメニューの位置。 |
settings.ui.components.virtual_currency.hidden | boolean | サブメニューを表示するかどうかを示します。 |
settings.ui.components.subscriptions | object | サブスクリプションプランのサブメニュー(オブジェクト)。 |
settings.ui.components.subscriptions.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.components.subscriptions.hidden | boolean | サブメニューを表示するかどうかを示します。 |
settings.ui.mode | string | ユーザーアカウントの決済インターフェース。user_account のみに指定できます:ヘッダーにはユーザーアカウントのナビゲーションメニューのみが含まれています。ユーザーは商品を選択したり、決済を行うことはできません。このモードは、デスクトップ上でのみ使用できます。 |
settings.ui.user_account | object | ユーザーアカウントの詳細(オブジェクト)。 |
settings.ui.user_account.info | object | マイアカウントページ。 |
settings.ui.user_account.info.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.user_account.info.enable | boolean | サブメニューを表示するかどうかを示します。既定ではfalse です。 |
settings.ui.user_account.history | object | 履歴サブメニュー。 |
settings.ui.user_account.history.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.user_account.history.enable | boolean | サブメニューを表示するかどうかを示します。既定ではfalse です。 |
settings.ui.user_account.payment_accounts | object | マイ決済アカウントサブメニュー。 |
settings.ui.user_account.payment_accounts.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.user_account.payment_accounts.enable | boolean | サブメニューを表示するかどうかを示します。既定ではfalse です。 |
settings.ui.user_account.subscriptions | object | サブスクリプション管理サブメニュー。 |
settings.ui.user_account.subscriptions.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.user_account.subscriptions.enable | 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 | integer | アイテム数量。 |
purchase.virtual_items.available_groups | array | アイテムグループのID(配列)。決済インターフェースには、指定したグループ内のアイテムのみが含まれます。 |
purchase.subscription | object | サブスクリプションデータ(オブジェクト)。 |
purchase.subscription.plan_id | string | プランID。 |
purchase.subscription.operation | string | ユーザーのサブスクリプションプランに適用される操作の種類。サブスクリプションプランを変更する場合は、値change_plan を渡します。purchase.subscription.plan_id パラメーターに新しいプランIDを指定してください。 |
purchase.subscription.product_id | string | 製品ID。 |
purchase.subscription.currency | string | すべての計算で使用するサブスクリプションプランの通貨。 |
purchase.subscription.available_plans | array | 決済インターフェイスに表示するサブスクリプションプラン(配列)。 |
purchase.subscription.trial_days | integer | 試用期間(日)。 |
purchase.pin_codes | object | ゲームキー(オブジェクト)。 |
purchase.pin_codes.currency | string | すべての計算で使用する注文内のゲームキーの通貨。 |
purchase.pin_codes.codes | array | ゲームキー(配列)。 |
purchase.pin_codes.codes.digital_content | string | パブリッシャ―アカウントに設定されたゲームのSKU。 |
purchase.pin_codes.codes.drm | string | DRMプラットフォームはゲームの配布に使用できます。steam 、playstation 、xbox 、uplay 、origin 、drmfree 、gog 、epicgames 、nintendo_eshop 、discord_game_store 、oculus のいずれかを指定できます。パブリッシャーアカウントで必要なDRMを設定していることをご確認ください。トークンに渡されなかった場合は、決済インターフェースでユーザーが選択します。 |
purchase.pin_codes.upgrade | object | アップグレードデータを持つオブジェクト。 |
purchase.pin_codes.upgrade.id_user_history | integer | エントリのIDで、ユーザーとパッケージのデータを含みます。 |
purchase.pin_codes.upgrade.id | integer | アップグレードID。 |
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 | 贈り物を受け取る人のメールアドレス。 |
purchase.coupon_code | object | 割引プロモーションコードまたは購入時のボーナスに関する情報(オブジェクト)。 |
purchase.coupon_code.value | string | プロモーションコードの値。 |
purchase.coupon_code.hidden | boolean | 決済インタフェースでプロモーションコードが入力されているフィールドを非表示にします。デフォルト設定ではfalse 。 |
custom_parameters | object | カスタムパラメータ、アイテムリストをフィルタリングするためのユーザー属性。 |
いずれかのパラメータが間違った形式で送信されたか、タイプが間違っている場合、トークンは発行されません。JSON本体にエラー記述とともに422
HTTPコードが送られます。このextended_message
は、どのパラメータが間違っていたかを示します。
- http
{
"extended_message": {
"global_errors": [],
"property_errors": {
"settings.project_id": [
"string value found, but an integer is required"
]
}
}
}
- http
- curl
- php
- C#
- python
- ruby
- java
- js
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token
Headers:
Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json
Body:
{
"purchase": {
"virtual_currency": {
"quantity": 100
},
"virtual_items": {
"items": [
{
"amount": 1,
"sku": "SKU01"
}
]
}
},
"settings": {
"currency": "USD",
"language": "en",
"project_id": 16184,
"ui": {
"components": {
"virtual_currency": {
"custom_amount": true
}
},
"desktop": {
"virtual_item_list": {
"button_with_price": true,
"layout": "list"
}
},
"size": "medium"
}
},
"user": {
"country": {
"allow_modify": true,
"value": "US"
},
"age": 19,
"email": {
"value": "john.smith@mail.com"
},
"id": {
"value": "user_2"
},
"name": {
"value": "John Smith"
}
}
}
curl --request POST \
--url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token \
--header 'authorization: Basic <your_authorization_basic_key>' \
--header 'content-type: application/json' \
--data '{"user":{"id":{"value":"user_2"},"name":{"value":"John Smith"},"age":19,"email":{"value":"john.smith@mail.com"},"country":{"value":"US","allow_modify":true}},"settings":{"project_id":16184,"currency":"USD","language":"en","ui":{"size":"medium","desktop":{"virtual_item_list":{"layout":"list","button_with_price":true}},"components":{"virtual_currency":{"custom_amount":true}}}},"purchase":{"virtual_currency":{"quantity":100},"virtual_items":{"items":[{"sku":"SKU01","amount":1}]}}}'
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{"user":{"id":{"value":"user_2"},"name":{"value":"John Smith"},"age":19,"email":{"value":"john.smith@mail.com"},"country":{"value":"US","allow_modify":true}},"settings":{"project_id":16184,"currency":"USD","language":"en","ui":{"size":"medium","desktop":{"virtual_item_list":{"layout":"list","button_with_price":true}},"components":{"virtual_currency":{"custom_amount":true}}}},"purchase":{"virtual_currency":{"quantity":100},"virtual_items":{"items":[{"sku":"SKU01","amount":1}]}}}');
$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'authorization' => 'Basic <your_authorization_basic_key>',
'content-type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"user\":{\"id\":{\"value\":\"user_2\"},\"name\":{\"value\":\"John Smith\"},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":16184,\"currency\":\"USD\",\"language\":\"en\",\"ui\":{\"size\":\"medium\",\"desktop\":{\"virtual_item_list\":{\"layout\":\"list\",\"button_with_price\":true}},\"components\":{\"virtual_currency\":{\"custom_amount\":true}}}},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"virtual_items\":{\"items\":[{\"sku\":\"SKU01\",\"amount\":1}]}}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client
conn = http.client.HTTPSConnection("api.xsolla.com")
payload = "{\"user\":{\"id\":{\"value\":\"user_2\"},\"name\":{\"value\":\"John Smith\"},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":16184,\"currency\":\"USD\",\"language\":\"en\",\"ui\":{\"size\":\"medium\",\"desktop\":{\"virtual_item_list\":{\"layout\":\"list\",\"button_with_price\":true}},\"components\":{\"virtual_currency\":{\"custom_amount\":true}}}},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"virtual_items\":{\"items\":[{\"sku\":\"SKU01\",\"amount\":1}]}}}"
headers = {
'content-type': "application/json",
'authorization': "Basic <your_authorization_basic_key>"
}
conn.request("POST", "/merchant/v2/merchants/{merchant_id}/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"user\":{\"id\":{\"value\":\"user_2\"},\"name\":{\"value\":\"John Smith\"},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":16184,\"currency\":\"USD\",\"language\":\"en\",\"ui\":{\"size\":\"medium\",\"desktop\":{\"virtual_item_list\":{\"layout\":\"list\",\"button_with_price\":true}},\"components\":{\"virtual_currency\":{\"custom_amount\":true}}}},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"virtual_items\":{\"items\":[{\"sku\":\"SKU01\",\"amount\":1}]}}}"
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"user\":{\"id\":{\"value\":\"user_2\"},\"name\":{\"value\":\"John Smith\"},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":16184,\"currency\":\"USD\",\"language\":\"en\",\"ui\":{\"size\":\"medium\",\"desktop\":{\"virtual_item_list\":{\"layout\":\"list\",\"button_with_price\":true}},\"components\":{\"virtual_currency\":{\"custom_amount\":true}}}},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"virtual_items\":{\"items\":[{\"sku\":\"SKU01\",\"amount\":1}]}}}");
Request request = new Request.Builder()
.url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token")
.post(body)
.addHeader("content-type", "application/json")
.addHeader("authorization", "Basic <your_authorization_basic_key>")
.build();
Response response = client.newCall(request).execute();
var data = JSON.stringify({
"user": {
"id": {
"value": "user_2"
},
"name": {
"value": "John Smith"
},
"age": 19,
"email": {
"value": "john.smith@mail.com"
},
"country": {
"value": "US",
"allow_modify": true
}
},
"settings": {
"project_id": 16184,
"currency": "USD",
"language": "en",
"ui": {
"size": "medium",
"desktop": {
"virtual_item_list": {
"layout": "list",
"button_with_price": true
}
},
"components": {
"virtual_currency": {
"custom_amount": true
}
}
}
},
"purchase": {
"virtual_currency": {
"quantity": 100
},
"virtual_items": {
"items": [
{
"sku": "SKU01",
"amount": 1
}
]
}
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");
xhr.send(data);
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
チェックアウトで購入するためのトークンを取得する (非推奨)
この方法は、少なくとも1つのストアモジュールをすでに構成しており、パブリッシャーアカウントの設定セクションの
チェックアウト購入のトークンを受け取る際に、以下のパラメータを設定します。
HTTPリクエスト
- http
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token
パラメータ | 種類 | 説明文 |
---|---|---|
user | object | ユーザーの詳細(オブジェクト)。 |
user.id | object | ユーザーID。 必須。 |
user.id.value | string | ユーザーID。 |
user.name | object | ユーザーのニックネームに関するデータを含むオブジェクト。 |
user.name.value | string | ユーザーのスクリーン名。 |
user.age | integer | ユーザーの年齢。 |
user.email | object | ユーザーのメール(オブジェクト)。このuser.emailオブジェクトは、不正対策モデルの構築と支払処理に不可欠な部分です。これは、エクソラと決済システムの両方の要件です。このパラメーターがないと、受入率が低下する可能性があります。 必須。 |
user.email.value | string | ユーザーのメールアドレス。RFC 822 で規定された書式を厳密に守らなければなりません。 必須。 |
user.phone | object | ユーザーの電話番号(オブジェクト)。 |
user.phone.value | string | ユーザーの電話番号。 |
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 | キャンペーンのコンテンツ。 |
user.is_legal | boolean | ユーザーが法人かを示します。 |
user.legal | object | 法人情報を含むオブジェクトです。user.is_legalがtrue の場合は、オブジェクトとその全パラメーターが必要です。 |
user.legal.name | string | 法人のフルネームです。 |
user.legal.address | string | 最後まで記載した法的住所です。 |
user.legal.vat_id | string | 納税者個別のID。 |
user.legal.country | string | 法人の国。ISO 3166-1 alpha-2に従って大文字2文字の国コードを使用します。 |
settings | object | カスタムプロジェクト設定(オブジェクト)。 |
settings.external_id | string | トランザクションの外部ID。 |
settings.project_id | integer | ゲームのエクソラ ID。パブリッシャ―アカウントにあります。 必須。 |
settings.language | string | インターフェース言語。2文字の小文字言語コード。 |
settings.return_url | string | ページを使用して決済後にユーザーをリダイレクトします。パラメータuser_id 、foreigninvoice 、invoice_id とstatus は、自動的にリンクに追加されます。 |
settings.redirect_policy | object | リダイレクトポリシーの設定(オブジェクト)。 |
settings.redirect_policy.redirect_conditions | string | ユーザーがリターンURLにリダイレクトされる決済状態。none 、successful 、successful_or_canceled 、またはany のいずれかとなります。 |
settings.redirect_policy.delay | integer | ユーザーがリターンURLに自動的にリダイレクトされるまでの遅延時間(秒)。 |
settings.redirect_policy.status_for_manual_redirection | string | リターンURLへのリダイレクトボタンが表示される決済状態。none 、successful 、successful_or_canceled 、またはany のいずれかとなります。 |
settings.redirect_policy.redirect_button_caption | string | 手動リダイレクト用のボタンのテキスト。 |
settings.currency | string | 標準の決済通貨。ISO 42173文字通貨コード。 |
settings.mode | string | 決済処理をテストするには、sandbox に設定します。この場合、https://sandbox-secure.xsolla.com を使用してテスト決済インターフェースにアクセスしてください。 |
settings.payment_method | integer | 決済方法のID。 |
settings.payment_widget | string | 決済ウィジェット。paybycash またはgiftcard が利用できます。パラメータが設定されている場合、ユーザーはそれぞれPay by CashまたはGift Cardsウィジェットにリダイレクトされます。 |
settings.ui | object | インタフェース設定(オブジェクト)。 |
settings.ui.theme | string | 決済インターフェースのテーマ。default (既定)または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.visible_purchase | boolean | ヘッダーに購入説明(purchase.description.value )を表示するか示します。デフォルトはtrue です。 |
settings.ui.desktop.header.type | string | ヘッダーを表示する方法。compact (プロジェクト名とユーザーIDを隠す)またはnormal (既定)に指定できます。 |
settings.ui.desktop.header.close_button | boolean | デスクトップ版決済ステーションに閉じるボタンを表示する設定。このボタンは決済ステーションを閉じて、settings.return_url パラメーターで指定されたURLにユーザーをリダイレクトします。デフォルトは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.mode | string | ユーザーアカウントの決済インターフェース。user_account のみに指定できます:ヘッダーにはユーザーアカウントのナビゲーションメニューのみが含まれています。ユーザーは商品を選択したり、決済を行うことはできません。このモードは、デスクトップ上でのみ使用できます。 |
settings.ui.user_account | object | ユーザーアカウントの詳細(オブジェクト)。 |
settings.ui.user_account.info | object | マイアカウントページ。 |
settings.ui.user_account.info.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.user_account.info.enable | boolean | サブメニューを表示するかどうかを示します。既定ではfalse です。 |
settings.ui.user_account.history | object | 履歴サブメニュー。 |
settings.ui.user_account.history.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.user_account.history.enable | boolean | サブメニューを表示するかどうかを示します。既定ではfalse です。 |
settings.ui.user_account.payment_accounts | object | マイ決済アカウントサブメニュー。 |
settings.ui.user_account.payment_accounts.order | integer | メニュー内のサブメニューの位置。 |
settings.ui.user_account.payment_accounts.enable | boolean | サブメニューを表示するかどうかを示します。既定ではfalse です。 |
settings.ui.user_account.subscriptions | object | サブスクリプション管理サブメニュー。 |
settings.ui.user_account.subscriptions.enable | boolean | サブメニューを表示するかどうかを示します。既定ではfalse です。 |
purchase | object | 購入の詳細を含むオブジェクト。 |
purchase.checkout | object | チェックアウトの詳細(オブジェクト)。 |
purchase.checkout.currency | string | 購入通貨。ISO 4217に準拠した3文字の通貨コード。 |
purchase.checkout.amount | float | 購入金額。 |
purchase.description | object | 購入の説明(オブジェクト)。 |
purchase.description.value | string | 一般購入の説明は決済UIおよびEメールのレシートに含めるようにします。各アイテムを個別に通す場合にはpurchase.description.items配列のパラメータを使用します。 |
purchase.description.items | array of objects | アイテム(配列)。 |
purchase.description.items.name | string | アイテム名。 |
purchase.description.items.image_url | string | アイテムアイコンへのリンク。 |
purchase.description.items.description | string | 購入時のアイテムの説明。 |
purchase.description.items.price | object | アイテムの価格を持つオブジェクト。 |
purchase.description.items.price.amount | string | アイテムの価格。 |
purchase.description.items.price.amount_before_discount | string | 割引前の商品価格。 |
purchase.description.items.quantity | integer | 購入時のアイテム数。 |
purchase.description.items.is_bonus | boolean | アイテムが無料でボーナスとして入手できるかどうか。デフォルトはfalse です。 |
- http
- curl
- php
- C#
- python
- ruby
- java
- js
POST https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token
Headers:
Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json
Body:
{
"user": {
"id": {
"value": "user_2",
"hidden": true
},
"age": 19,
"email": {
"value": "john.smith@mail.com"
},
"country": {
"value": "US",
"allow_modify": true
}
},
"settings": {
"project_id": 1234,
"language": "en",
"currency": "USD"
},
"purchase": {
"checkout": {
"currency": "USD",
"amount": 20
},
"description": {
"value": "Purchase",
"items": [
{
"name": "Rocket",
"quantity": 5,
"price": {
"amount": "2",
"amount_before_discount": "10.5"
},
"description": "This is a rocket."
},
{
"name": "Sword",
"quantity": 5,
"price": {
"amount": "2"
},
"description": "This is a sword."
}
]
}
}
}
curl --request POST \
--url https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token \
--header 'authorization: Basic <your_authorization_basic_key>' \
--header 'content-type: application/json' \
--data '{"user":{"id":{"value":"user_2","hidden":true},"age":19,"email":{"value":"john.smith@mail.com"},"country":{
"value":"US","allow_modify":true}},"settings":{"project_id":1234,"language":"en","currency":"USD"},"purchase":{"checkout":{"currency":"USD","amount":20},"description":{"value":"Purchase","items":[{"name": "Rocket","quantity":5,"price":{"amount":"2","amount_before_discount":"10.5"},"description":"This is a rocket."},{"name":"Sword","quantity":5,"price":{"amount":"2"},"description": "This is a sword."}]}}}'
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{"user":{"id":{"value":"user_2","hidden":true},"age":19,"email":{"value":"john.smith@mail.com"},"country":{
"value":"US","allow_modify":true}},"settings":{"project_id":1234,"language":"en","currency":"USD"},"purchase":{"checkout":{"currency":"USD","amount":20},"description":{"value":"Purchase","items":[{"name": "Rocket","quantity":5,"price":{"amount":"2","amount_before_discount":"10.5"},"description":"This is a rocket."},{"name":"Sword","quantity":5,"price":{"amount":"2"},"description": "This is a sword."}]}}}');
$request->setRequestUrl('https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'authorization' => 'Basic <your_authorization_basic_key>',
'content-type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"user\":{\"id\":{\"value\:\"user_2\",\"hidden\":true},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{
\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":1234,\"language\":\"en\",\"currency\":\"USD\"},\"purchase\":{\"checkout\":{\"currency\":\"USD\",\"amount\":20},\"description\":{\"value\":\"Purchase\",\"items\":[{\"name\": \"Rocket\",\"quantity\":5,\"price\":{\"amount\":\"2\",\"amount_before_discount\":\"10.5\"},\"description\":\"This is a rocket.\"},{\"name\":\"Sword\",\"quantity\":5,\"price\":{\"amount\":\"2\"},\"description\": \"This is a sword.\"}]}}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client
conn = http.client.HTTPSConnection("api.xsolla.com")
payload = "{\"user\":{\"id\":{\"value\:\"user_2\",\"hidden\":true},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{
\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":1234,\"language\":\"en\",\"currency\":\"USD\"},\"purchase\":{\"checkout\":{\"currency\":\"USD\",\"amount\":20},\"description\":{\"value\":\"Purchase\",\"items\":[{\"name\": \"Rocket\",\"quantity\":5,\"price\":{\"amount\":\"2\",\"amount_before_discount\":\"10.5\"},\"description\":\"This is a rocket.\"},{\"name\":\"Sword\",\"quantity\":5,\"price\":{\"amount\":\"2\"},\"description\": \"This is a sword.\"}]}}}"
headers = {
'content-type': "application/json",
'authorization': "Basic <your_authorization_basic_key>"
}
conn.request("POST", "/merchant/v2/merchants/{merchant_id}/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"user\":{\"id\":{\"value\:\"user_2\",\"hidden\":true},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{
\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":1234,\"language\":\"en\",\"currency\":\"USD\"},\"purchase\":{\"checkout\":{\"currency\":\"USD\",\"amount\":20},\"description\":{\"value\":\"Purchase\",\"items\":[{\"name\": \"Rocket\",\"quantity\":5,\"price\":{\"amount\":\"2\",\"amount_before_discount\":\"10.5\"},\"description\":\"This is a rocket.\"},{\"name\":\"Sword\",\"quantity\":5,\"price\":{\"amount\":\"2\"},\"description\": \"This is a sword.\"}]}}}"
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"user\":{\"id\":{\"value\:\"user_2\",\"hidden\":true},\"age\":19,\"email\":{\"value\":\"john.smith@mail.com\"},\"country\":{
\"value\":\"US\",\"allow_modify\":true}},\"settings\":{\"project_id\":1234,\"language\":\"en\",\"currency\":\"USD\"},\"purchase\":{\"checkout\":{\"currency\":\"USD\",\"amount\":20},\"description\":{\"value\":\"Purchase\",\"items\":[{\"name\": \"Rocket\",\"quantity\":5,\"price\":{\"amount\":\"2\",\"amount_before_discount\":\"10.5\"},\"description\":\"This is a rocket.\"},{\"name\":\"Sword\",\"quantity\":5,\"price\":{\"amount\":\"2\"},\"description\": \"This is a sword.\"}]}}}");
Request request = new Request.Builder()
.url("https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token")
.post(body)
.addHeader("content-type", "application/json")
.addHeader("authorization", "Basic <your_authorization_basic_key>")
.build();
Response response = client.newCall(request).execute();
var data = JSON.stringify({
"user": {
"id": {
"value": "user_2",
"hidden": true
},
"age": 19,
"email": {
"value": "john.smith@mail.com"
},
"country": {
"value": "US",
"allow_modify": true
}
},
"settings": {
"project_id": 1234,
"language": "en",
"currency": "USD"
},
"purchase": {
"checkout": {
"currency": "USD",
"amount": 20
},
"description": {
"value": "Purchase",
"items": [
{
"name": "Rocket",
"quantity": 5,
"price": {
"amount": "2",
"amount_before_discount": "10.5"
},
"description": "This is a rocket."
},
{
"name": "Sword",
"quantity": 5,
"price": {
"amount": "2"
},
"description": "This is a sword."
}
]
}
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.xsolla.com/merchant/v2/merchants/{merchant_id}/token");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");
xhr.send(data);
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
{
"token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}
その他のパラメータ一覧
custom_parameters
オブジェクトのトークンに追加パラメータを渡して、不正対策フィルタを設定できます。推奨のパラメータを以下の表で確認してください。必要に応じて一覧を全文表示できます。
パラメータ | 種類 | 説明文 |
---|---|---|
registration_date | string | ISO 8601形式のアカウント作成日。 |
total_hours | integer | 合計ゲーム時間数。 |
total_characters | integer | ゲーム内のキャラクターの数。 |
social_networks_added | boolean | プレイヤーがソーシャルメディアプロファイルを接続しているかを示します。 |
profile_image_added | boolean | プレイヤーがプロフィール画像をアップロードしたかどうかを示します。 |
active_date | string | ISO 8601形式の最終閲覧日。 |
total_friends | integer | 友達の数。 |
additional_verification | boolean | プレイヤーがアカウント承認手続きを使用するかどうかを示します。 |
win_rate | integer | 勝率。 |
last_change_password_date | string | ISO 8601に沿ったパスワード最終更新日。 |
chat_activity | boolean | プレイヤーがチャット機能を使用するかどうかを示します。 |
forum_activity | boolean | プレイヤーがフォーラム機能を使用するかどうかを示す。 |
total_bans | integer | チャットやフォーラムでプレイヤーが禁止された回数。 |
profile_completed | boolean | プレイヤーがプロフィールに追加情報を入力したかどうかを示します。 |
notifications_enabled | boolean | プレイヤーが通知を有効化したかどうかを示します。 |
user_level | integer | プレイヤーのレベル、評判、またはランク。 |
karma_points | integer | プレイヤーのカルマ値。 |
total_sum | float | 総支払額。 |
non_premium_currency | float | 非プレミアム通貨の金額。 |
total_game_events | integer | プレイヤーが参加したゲーム内イベントの数。 |
total_gifts | integer | プレイヤーが送受信したゲーム内の贈り物の数。 |
tutorial_completed | boolean | プレイヤーがゲームのチュートリアルを完了したかどうかを示します。 |
completed_tasks | integer | 完了したタスクや目標の数。 |
items_used | boolean | プレイヤーが購入したゲームアイテムを使用するかどうかを示します。 |
pvp_activity | boolean | プレイヤーが対人戦に参加するかどうかを示します。 |
total_clans | integer | プレイヤーがメンバーになっているクランの数。 |
unlocked_achievements | integer | 達成した実績の数。 |
total_inventory_value | float | インベントリ総額(ゲーム内通貨)。 |
character_customized | boolean | プレイヤーがキャラクターをカスタマイズしたかどうかを示します。 |
session_time | string | ISO 8601に沿った平均セッション時間。 |
トークン化
アプリのトークン化設定の詳細については、決済ステーション説明書を参照してください。
保存された決済アカウントの一覧
特定のユーザーの保存された決済アカウントを一覧表示します。
HTTPリクエスト
- http
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts
パラメータ | 種類 | 説明文 |
---|---|---|
project_id | integer | プロジェクトID。 |
user_id | string | ユーザーID。 |
- http
- curl
- php
- C#
- python
- ruby
- java
- js
GET https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts
Headers:
Authorization: Basic <your_authorization_basic_key>
curl --request GET \
--url https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts \
--header 'authorization: Basic <your_authorization_basic_key> '
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts');
$request->setRequestMethod('GET');
$request->setHeaders(array(
'authorization' => 'Basic <your_authorization_basic_key> '
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic <your_authorization_basic_key> ");
IRestResponse response = client.Execute(request);
import http.client
conn = http.client.HTTPSConnection("api.xsolla.com")
headers = { 'authorization': "Basic <your_authorization_basic_key> " }
conn.request("GET", "/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key> '
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts")
.get()
.addHeader("authorization", "Basic <your_authorization_basic_key> ")
.build();
Response response = client.newCall(request).execute();
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key> ");
xhr.send(data);
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
[
{
"id": 4612345,
"name": "PP_saved_account",
"payment_system": {
"id": 24,
"name": "PayPal"
},
"type": "paypal"
}
]
保存されたアカウントで課金する
保存された決済アカウントを介してユーザーに請求する。
HTTPリクエスト
- http
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}
パラメータ | 種類 | 説明文 |
---|---|---|
project_id | integer | プロジェクトID。 必須。 |
user_id | string | ユーザーID。 必須。 |
type | string | 決済アカウントの種類。 必須。 可能な数値:card — 銀行カード、amazon — Amazon Pay、skrill — Skrill Digital Wallet、yandex — Yandex.Money、paymasterwebmoney — WebMoney、paypal — PayPal、qiwi — QIWIウォレット。HTTP 200 成功ステータスコードを受信した場合、リクエストはトランザクション ID とそのステータスを返します。可能なステータス:
|
account_id | integer | エクソラデータベースに保存されたアカウントのID。 必須。 |
user | object | ユーザーの詳細(オブジェクト)。 |
user.ip | string | ユーザーのIPアドレス。 必須。 |
user.name | string | ユーザー名。 |
user.legal | object | 法人情報を含むオブジェクトです。 |
user.legal.name | string | 法人のフルネームです。 |
user.legal.address | string | 最後まで記載した法的住所です。 |
user.legal.vat_id | string | 納税者個別のID。 |
user.legal.country | string | 法人の国。ISO 3166-1 alpha-2に従って大文字2文字の国コードを使用します。 |
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 に設定します。実際の決済用にパラメータを削除します。 |
custom_parameters | string | カスタムパラメータ、アイテムリストをフィルタリングするためのユーザー属性。 |
- http
- curl
- php
- C#
- python
- ruby
- java
- js
POST https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}
Headers:
Authorization: Basic <your_authorization_basic_key>
Content-Type: application/json
Body:
{
"card": {
"cvn": "123"
},
"purchase": {
"description": {
"value": "currency purchase"
},
"virtual_currency": {
"quantity": 100
}
},
"settings": {
"currency": "USD",
"external_id": "ext123",
"save": true
},
"user": {
"id": "user123",
"ip": "111.11.11.11",
"name": "John Smith",
"legal" : {
"name": "My Awesome Company",
"address": "17 Crown Street London SW2 0JW United Kingdom",
"vat_id": "GB111111111",
"country": "GB"
}
}
curl --request POST \
--url https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id} \
--header 'authorization: Basic <your_authorization_basic_key>' \
--header 'content-type: application/json' \
--data '{"user":{"id":"user123","ip":"111.11.11.11","name":"John Smith","legal":{"name":"My Awesome Company","address":"17 Crown Street London SW2 0JW United Kingdom","vat_id":"GB111111111","country":" GB"}},"card":{"cvn":"123"},"purchase":{"virtual_currency":{"quantity":100},"description":{"value":"currency purchase"}},"settings":{"save":true,"currency":"USD","external_id":"ext123"}}'
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{"user":{"id":"user123","ip":"111.11.11.11","name":"John Smith","legal":{"name":"My Awesome Company","address":"17 Crown Street London SW2 0JW United Kingdom","vat_id":"GB111111111","country":" GB"}},"card":{"cvn":"123"},"purchase":{"virtual_currency":{"quantity":100},"description":{"value":"currency purchase"}},"settings":{"save":true,"currency":"USD","external_id":"ext123"}}');
$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'authorization' => 'Basic <your_authorization_basic_key>',
'content-type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"user\":{\"id\":\"user123\",\"ip\":\"111.11.11.11\",\"name\":\"John Smith\",\"legal\":{\"name\":\"My Awesome Company\",\"address\":\"17 Crown Street London SW2 0JW United Kingdom\",\"vat_id\":\"GB111111111\",\"country\":\"GB\"}},\"card\":{\"cvn\":\"123\"},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"description\":{\"value\":\"currency purchase\"}},\"settings\":{\"save\":true,\"currency\":\"USD\",\"external_id\":\"ext123\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import http.client
conn = http.client.HTTPSConnection("api.xsolla.com")
payload = "{\"user\":{\"id\":\"user123\",\"ip\":\"111.11.11.11\",\"name\":\"John Smith\",\"legal\":{\"name\":\"My Awesome Company\",\"address\":\"17 Crown Street London SW2 0JW United Kingdom\",\"vat_id\":\"GB111111111\",\"country\":\"GB\"}},\"card\":{\"cvn\":\"123\"},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"description\":{\"value\":\"currency purchase\"}},\"settings\":{\"save\":true,\"currency\":\"USD\",\"external_id\":\"ext123\"}}"
headers = {
'content-type': "application/json",
'authorization': "Basic <your_authorization_basic_key>"
}
conn.request("POST", "/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic <your_authorization_basic_key>'
request.body = "{\"user\":{\"id\":\"user123\",\"ip\":\"111.11.11.11\",\"name\":\"John Smith\",\"legal\":{\"name\":\"My Awesome Company\",\"address\":\"17 Crown Street London SW2 0JW United Kingdom\",\"vat_id\":\"GB111111111\",\"country\":\"GB\"}},\"card\":{\"cvn\":\"123\"},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"description\":{\"value\":\"currency purchase\"}},\"settings\":{\"save\":true,\"currency\":\"USD\",\"external_id\":\"ext123\"}}"
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"user\":{\"id\":\"user123\",\"ip\":\"111.11.11.11\",\"name\":\"John Smith\",\"legal\":{\"name\":\"My Awesome Company\",\"address\":\"17 Crown Street London SW2 0JW United Kingdom\",\"vat_id\":\"GB111111111\",\"country\":\"GB\"}},\"card\":{\"cvn\":\"123\"},\"purchase\":{\"virtual_currency\":{\"quantity\":100},\"description\":{\"value\":\"currency purchase\"}},\"settings\":{\"save\":true,\"currency\":\"USD\",\"external_id\":\"ext123\"}}");
Request request = new Request.Builder()
.url("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}")
.post(body)
.addHeader("content-type", "application/json")
.addHeader("authorization", "Basic <your_authorization_basic_key>")
.build();
Response response = client.newCall(request).execute();
var data = JSON.stringify({
"user": {
"id": "user123",
"ip": "111.11.11.11",
"name": "John Smith",
"legal" : {
"name": "My Awesome Company",
"address": "17 Crown Street London SW2 0JW United Kingdom",
"vat_id": "GB111111111",
"country": "GB"
},
},
"card": {
"cvn": "123"
},
"purchase": {
"virtual_currency": {
"quantity": 100
},
"description": {
"value": "currency purchase"
}
},
"settings": {
"save": true,
"currency": "USD",
"external_id": "ext123"
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");
xhr.send(data);
{
"transaction_id": 123458390
}
{
"transaction_id": 123458390
}
{
"transaction_id": 123458390
}
{
"transaction_id": 123458390
}
{
"transaction_id": 123458390
}
{
"transaction_id": 123458390
}
{
"transaction_id": 123458390
}
{
"transaction_id": 123458390
}
保存された決済アカウントの削除
保存済みの決済アカウントを削除します。
HTTPリクエスト
- http
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}
パラメータ | 種類 | 説明文 |
---|---|---|
project_id | integer | プロジェクトID。 |
user_id | string | ユーザーID。 |
type | string | 決済アカウントの種類。 可能な数値:card — 銀行カード、amazon — Amazon Pay、skrill — Skrill Digital Wallet、yandex — Yandex.Money、paymasterwebmoney — WebMoney、paypal — PayPal、qiwi — QIWIウォレット。HTTP 200 成功ステータスコードを受信した場合、リクエストはトランザクション ID とそのステータスを返します。可能なステータス:
|
account_id | integer | エクソラデータベースに保存されたアカウントのID。 |
- http
- curl
- php
- C#
- python
- ruby
- java
- js
DELETE https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}
Headers:
Authorization: Basic <your_authorization_basic_key>
curl --request DELETE \
--url https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id} \
--header 'authorization: Basic <your_authorization_basic_key>'
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
'authorization' => 'Basic <your_authorization_basic_key>'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
var client = new RestClient("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Basic <your_authorization_basic_key>");
IRestResponse response = client.Execute(request);
import http.client
conn = http.client.HTTPSConnection("api.xsolla.com")
headers = { 'authorization': "Basic <your_authorization_basic_key>" }
conn.request("DELETE", "/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require 'uri'
require 'net/http'
url = URI("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Basic <your_authorization_basic_key>'
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}")
.delete(null)
.addHeader("authorization", "Basic <your_authorization_basic_key>")
.build();
Response response = client.newCall(request).execute();
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://api.xsolla.com/merchant/v2/projects/{project_id}/users/{user_id}/payment_accounts/{type}/{account_id}");
xhr.setRequestHeader("authorization", "Basic <your_authorization_basic_key>");
xhr.send(data);