# トークンを作成する 任意のユーザー パラメータを使用してトークンを作成できます。トークンを取得するときにこれらのパラメータを送信し、支払いが成功した後にそれらを受け取ります。トークンには、このドキュメントで説明されているか、またはユーザーが事前に定義したパラメータのみを含めることができます。 パラメータが間違った形式で送信されたり、間違ったタイプである場合、トークンは発行されません。JSON 本文にエラーの説明を含む 422 HTTP コードが返されます。extended_message には、正確にどのパラメータが間違って送信されたかに関する情報が返されます。 通知APIコールにproject_idパスパラメータが含まれていないため、会社の全プロジェクトで有効なAPIキーを使用して認可を設定する必要があります。 Endpoint: POST /merchants/{merchant_id}/token Version: 2.0 Security: basicAuth ## Path parameters: - `merchant_id` (integer, required) マーチャントID。 ## Request fields (application/json): - `custom_parameters` (object) custom_parametersオブジェクトのトークンに追加のパラメーターを渡して、不正防止フィルターを設定することができます。ドロップダウンリストには推奨パラメータが表示されます。[決済ステーション説明書](https://developers.xsolla.com/ja/doc/pay-station/features/antifraud/)を参照してください。 - `custom_parameters.active_date` (string) [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)形式の最終閲覧日。 - `custom_parameters.additional_verification` (boolean) プレイヤーがアカウント承認手続きを使用するかどうかを示します。 - `custom_parameters.character_customized` (boolean) プレイヤーがキャラクターをカスタマイズしたかどうかを示します。 - `custom_parameters.chat_activity` (boolean) プレイヤーがチャット機能を使用するかどうかを示します。 - `custom_parameters.completed_tasks` (integer) 完了したタスクや目標の数。 - `custom_parameters.forum_activity` (boolean) プレイヤーがフォーラム機能を使用するかどうかを示す。 - `custom_parameters.items_used` (boolean) プレイヤーが購入したゲームアイテムを使用するかどうかを示します。 - `custom_parameters.karma_points` (integer) プレイヤーのカルマ値。 - `custom_parameters.last_change_password_date` (string) [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)に沿ったパスワード最終更新日。 - `custom_parameters.non_premium_currency` (integer) 非プレミアム通貨の金額。 - `custom_parameters.notifications_enabled` (boolean) プレイヤーが通知を有効化したかどうかを示します。 - `custom_parameters.profile_completed` (boolean) プレイヤーがプロフィールに追加情報を入力したかどうかを示します。 - `custom_parameters.profile_image_added` (boolean) プレイヤーがプロフィール画像をアップロードしたかどうかを示します。 - `custom_parameters.pvp_activity` (boolean) プレイヤーが対人戦に参加するかどうかを示します。 - `custom_parameters.registration_date` (string) [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)形式のアカウント作成日。 - `custom_parameters.session_time` (string) [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)に沿った平均セッション時間。 - `custom_parameters.social_networks_added` (boolean) プレイヤーがソーシャルメディアプロファイルを接続しているかを示します。 - `custom_parameters.total_bans` (integer) チャットやフォーラムでプレイヤーが禁止された回数。 - `custom_parameters.total_characters` (integer) ゲーム内のキャラクターの数。 - `custom_parameters.total_clans` (integer) プレイヤーがメンバーになっているクランの数。 - `custom_parameters.total_friends` (integer) 友達の数。 - `custom_parameters.total_game_events` (integer) プレイヤーが参加したゲーム内イベントの数。 - `custom_parameters.total_gifts` (integer) プレイヤーが送受信したゲーム内の贈り物の数。 - `custom_parameters.total_hours` (integer) 合計ゲーム時間数。 - `custom_parameters.total_inventory_value` (integer) インベントリ総額(ゲーム内通貨)。 - `custom_parameters.total_sum` (integer) 総支払額。 - `custom_parameters.tutorial_completed` (boolean) プレイヤーがゲームのチュートリアルを完了したかどうかを示します。 - `custom_parameters.unlocked_achievements` (integer) 達成した実績の数。 - `custom_parameters.user_level` (integer) プレイヤーのレベル、評判、またはランク。 - `custom_parameters.win_rate` (integer) 勝率。 - `purchase` (object) 購入の詳細を含むオブジェクト。 Example: {"checkout":{"amount":10,"currency":"USD"},"subscription":{"gift":{"email":"recipient_email@email.com","recipient":"test_recipient_v1"}}} - `purchase.checkout` (object) チェックアウトの詳細(オブジェクト)。 Example: {"amount":10,"currency":"USD"} - `purchase.checkout.amount` (integer) 購入金額。 Example: 10 - `purchase.checkout.currency` (string) 購入通貨。[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)に準拠した3文字の通貨コード。 Example: "USD" - `purchase.subscription` (object) サブスクリプションデータ(オブジェクト)。 Example: {"gift":{"email":"recipient_email@email.com","recipient":"test_recipient_v1"}} - `purchase.subscription.available_plans` (array) 決済インターフェイスに表示するサブスクリプションプラン(配列)。 - `purchase.subscription.currency` (string) すべての計算で使用するサブスクリプションプランの通貨。 - `purchase.subscription.gift` (object) 贈られたサブスクリプションの詳細。 Example: {"email":"recipient_email@email.com","recipient":"test_recipient_v1"} - `purchase.subscription.gift.anonymous` (boolean) 贈り主の名前を非表示にするかどうか。trueの場合、電子メール通知で送り主の名前は非表示にされます。デフォルトはfalseです。 - `purchase.subscription.gift.email` (string, required) 受取人のメールアドレス。 Example: "recipient_email@email.com" - `purchase.subscription.gift.message` (string) 受取人へのメッセージ。 - `purchase.subscription.gift.recipient` (string, required) 受取人のID。 Example: "test_recipient_v1" - `purchase.subscription.gift.redirect_url` (string) ここに、贈られたサブスクリプションに関する追加情報が掲載されたページ、またはアカウント作成ページへのリンクを設定してください。ギフトの受取人は、サブスクリプションギフトの通知メールからこのページに移動することができます。 - `purchase.subscription.operation` (string) ユーザーのサブスクリプションプランに適用される操作の種類。サブスクリプションプランを変更する場合は、値change_planを渡します。purchase.subscription.plan_idパラメーターに新しいプランIDを指定してください。 - `purchase.subscription.plan_id` (string) サブスクリプションプランの外部ID。これは、アドミンページのサブスクリプション > サブスクリプションプランセクションで確認できます。 - `purchase.subscription.product_id` (string) 製品ID。 - `purchase.subscription.trial_days` (integer) 試用期間(日)。 - `settings` (object) カスタムプロジェクト設定(オブジェクト)。 Example: {"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"}} - `settings.currency` (string) 標準の決済通貨。[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)3文字通貨コード。 Example: "USD" - `settings.external_id` (string) ゲーム内のトランザクションID。各ユーザーの支払いに対して一意でなければならなりません。 - `settings.language` (string) インターフェース言語。2文字の小文字[言語コード](https://developers.xsolla.com/ja/doc/pay-station/features/localization/)。 Example: "en" - `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ウィジェットにそれぞれリダイレクトされます。 Enum: "paybycash", "giftcard" - `settings.project_id` (integer, required) Game’s Xsolla ID. Can be found in Publisher Account. Example: 16184 - `settings.redirect_policy` (object) リダイレクトポリシーの設定(オブジェクト)。 - `settings.redirect_policy.autoredirect_from_status_page` (boolean) ステータスページから自動的にリダイレクトするかどうか。 - `settings.redirect_policy.delay` (integer) ユーザーがリターンURLに自動的にリダイレクトされるまでの遅延時間(秒)。 - `settings.redirect_policy.manual_redirection_action` (string) 決済ステーション動作はユーザーが「閉じる」ボタンや「ゲームに戻る」ボタンをクリックすること​によって引き起こされます。redirect(デフォルト)とpostmessageにすることができます。redirectに設定すると、ユーザーはトークンで渡された、またはアドミンページで指定されたURLにリダイレクトされます。postmessageに設定すると、ユーザーは他のページにリダイレクトされません。「閉じる」アイコンをクリックすると、closeイベントが開始され、「ゲームに戻る」をクリックすると、returnイベントが開始されます。 Enum: "redirect", "postmessage" - `settings.redirect_policy.redirect_button_caption` (string) 手動リダイレクト用のボタンのテキスト。 - `settings.redirect_policy.redirect_conditions` (string) ユーザーがリターンURLにリダイレクトされる決済状態。none、successful、successful_or_canсeled、またはanyのいずれかとなります。 Enum: "none", "successful", "successful_or_canceled", "any" - `settings.redirect_policy.status_for_manual_redirection` (string) リターンURLへのリダイレクトボタンが表示される決済状態。none、successful、successful_or_canсeled、またはanyのいずれかとなります。 Enum: "none", "successful", "successful_or_canceled", "any" - `settings.return_url` (string) ページを使用して決済後にユーザーをリダイレクトします。パラメーターuser_id、foreigninvoice、invoice_idとstatusは、自動的にリンクに追加されます。 - `settings.ui` (object) インタフェース設定(オブジェクト)。 Example: {"components":{"virtual_currency":{"custom_amount":true}},"desktop":{"virtual_item_list":{"button_with_price":true,"layout":"list"}},"size":"medium"} - `settings.ui.components` (object) メニュー設定(オブジェクト)。 Example: {"virtual_currency":{"custom_amount":true}} - `settings.ui.components.subscriptions` (object) サブスクリプションプランのサブメニュー(オブジェクト)。 - `settings.ui.components.subscriptions.hidden` (boolean) サブメニューを表示するかどうかを示します。 - `settings.ui.components.subscriptions.order` (integer) メニュー内のサブメニューの位置。 - `settings.ui.components.virtual_currency` (object) 仮想通貨サブメニュー。 Example: {"custom_amount":true} - `settings.ui.components.virtual_currency.custom_amount` (boolean) ユーザーが任意の数の仮想通貨を決済インターフェースに入力できるかどうかを示します。 Example: true - `settings.ui.components.virtual_items` (object) 仮想アイテムサブメニュー。 - `settings.ui.components.virtual_items.selected_group` (string) 仮想アイテムタブを開いた後に表示するグループ。 - `settings.ui.components.virtual_items.selected_item` (string) 仮想アイテムタブを開いた後に表示されるアイテム(アイテムSKU)。 - `settings.ui.desktop` (object) デスクトップバージョン(オブジェクト)のインターフェース設定。 Example: {"virtual_item_list":{"button_with_price":true,"layout":"list"}} - `settings.ui.desktop.header` (object) ヘッダー設定(オブジェクト)。 - `settings.ui.desktop.header.close_button` (boolean) デスクトップ版決済ステーションに閉じるボタンを表示する設定。このボタンは決済ステーションを閉じて、settings.return_urlパラメーターで指定されたURLにユーザーをリダイレクトします。デフォルトはfalseです。 - `settings.ui.desktop.header.is_visible` (boolean) 決済インターフェースにヘッダーを表示するかどうかを示します。 - `settings.ui.desktop.header.type` (string) ヘッダーを表示する方法。compact(プロジェクト名とユーザーIDを隠す)またはnormal(既定)に指定できます。 Enum: "compact", "normal" - `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.subscription_list` (object) サブスクリプションプラン(オブジェクト)の一覧の設定。 - `settings.ui.desktop.subscription_list.description` (string) 決済インターフェースの利用可能なサブスクリプションプランの一覧上に表示されるテキスト。 - `settings.ui.desktop.subscription_list.display_local_price` (boolean) trueの場合、ユーザーの現地通貨が購読プランに設定されている通貨と異なる場合、ユーザーは両方の価格を見ることができます。1つは現地通貨で、もう1つは基本通貨で表示されます。 - `settings.ui.desktop.subscription_list.layout` (string) テンプレートの一覧。list(既定)またはgridに指定できます。 Enum: "list", "grid" - `settings.ui.desktop.virtual_currency_list` (object) 仮想通貨(オブジェクト)の一覧の設定。 - `settings.ui.desktop.virtual_currency_list.button_with_price` (boolean) trueの場合は、価格がボタンに表示されます。falseの場合は、価格はボタンの左側に表示されます。既定ではfalseです。 - `settings.ui.desktop.virtual_currency_list.description` (string) 決済インターフェースの一覧の上に表示するテキスト。 - `settings.ui.desktop.virtual_item_list` (object) 仮想アイテム(オブジェクト)の一覧の設定。 Example: {"button_with_price":true,"layout":"list"} - `settings.ui.desktop.virtual_item_list.view` (string) 縦方向または横方向のメニューに仮想アイテムのグループを表示しましょう。horizontal_navigationあるいはvertical_navigation(既定)にできます。 Enum: "horizontal_navigation", "vertical_navigation" - `settings.ui.header` (object) - `settings.ui.header.visible_virtual_currency_balance` (boolean) この要素を決済インターフェースで非示にできるかどうかを示します。既定ではtrueです。 - `settings.ui.is_prevent_external_link_open` (boolean) リンクを外部リソースにリダイレクトするかどうかを無効にします。デフォルトはtrueです。外部リンクをクリックすると、external-link-openイベントがpostMessageメカニズムを介して送信されます。urlパラメータには、リダイレクト先のリンクのアドレスが渡されます。 - `settings.ui.license_url` (string) EULAへのリンク。 - `settings.ui.mobile` (object) - `settings.ui.mobile.footer` (object) - `settings.ui.mobile.footer.is_visible` (boolean) モバイル版の決済インターフェースでフッターを非表示にするかどうかを示します。 - `settings.ui.mobile.mode` (string) ユーザーは、保存された決済方法を使用してのみ決済を行うことができます。saved_accountsに指定できます。 Enum: "saved_accounts" - `settings.ui.mode` (string) ユーザーアカウントの決済インターフェース。user_accountのみに指定できます:ヘッダーにはユーザーアカウントのナビゲーションメニューのみが含まれています。ユーザーは商品を選択したり、決済を行うことはできません。このモードは、デスクトップ上でのみ使用できます。 - `settings.ui.size` (string) 決済インターフェースのサイズ。に指定できます: - [small](https://livedemo.xsolla.com/developers/small/):決済インターフェースの最小サイズです。ウィンドウサイズが厳密に制限されている場合は、この値を使用します(寸法:620 x 630) - [medium](https://livedemo.xsolla.com/developers/medium/):推奨サイズ。この値を使用して、ライトボックスに決済インターフェイスを表示します(寸法:740 x 760) - [large](https://livedemo.xsolla.com/developers/large/):決済インターフェイスを新しいウィンドウまたはタブに表示するのに最適なサイズ(寸法:820 x 840) Enum: "small", "medium", "large" - `settings.ui.theme` (string) 決済インターフェースのテーマ。default(既定)またはdefault_darkに指定できます。 Enum: "default", "default_dark" - `settings.ui.user_account` (object) ユーザーアカウントの詳細(オブジェクト)。 - `settings.ui.user_account.history` (object) 履歴 サブメニュー。 - `settings.ui.user_account.history.enable` (boolean) サブメニューを表示するかどうかを示します。既定ではfalseです。 - `settings.ui.user_account.info` (object) 私のアカウント ページ。 - `settings.ui.user_account.payment_accounts` (object) お客様の決済アカウント サブメニュー。 - `settings.ui.user_account.subscriptions` (object) サブスクリプションの管理 サブメニュー。 - `settings.ui.version` (string) デバイスの種類。desktop(既定)またはmobileに指定できます。 Enum: "desktop", "mobile" - `user` (object) ユーザーの詳細(オブジェクト)。 Example: {"age":19,"country":{"allow_modify":true,"value":"US"},"email":{"value":"john.smith@mail.com"},"id":{"value":"user_2"},"name":{"value":"John Smith"}} - `user.age` (integer) ユーザーの年齢。 Example: 19 - `user.attributes` (object) キー値ペアの有効なJSONセットとして表される、アイテムリストをフィルタリングするためのユーザー属性。 - `user.country` (object) Example: {"allow_modify":true,"value":"US"} - `user.country.allow_modify` (boolean) ユーザーが決済UIで国を変更できるかどうか。トークンにcountry.valueが渡された場合、デフォルトではfalseとなります。 Example: true - `user.country.value` (string) ユーザーの国。2文字の国コード(大文字)は、[ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)に従って使用されます。 Example: "US" - `user.email` (object) user.emailオブジェクトは、不正対策モデルの構築に不可欠な要素であり、受け入れ率の向上に貢献します。それは、エクソーラと決済システムの両方の要件です。パラメータが渡されない場合は、決済ページにメール入力の必須項目が表示されます。ユーザーは、パラメータに渡された、または決済ページで入力された電子メールに購入領収書を受け取ります。 Example: {"value":"john.smith@mail.com"} - `user.email.value` (string, required) ユーザーのメールアドレス。[RFC 822](https://www.w3.org/Protocols/rfc822/#z8)で規定された書式を厳密に守らなければなりません。 Example: "john.smith@mail.com" - `user.id` (object, required) Example: {"value":"user_2"} - `user.id.value` (string, required) ユーザーID。 Example: "user_2" - `user.is_legal` (boolean) ユーザーが法人かを示します。 - `user.legal` (object) 法人情報を含むオブジェクトです。user.is_legalがtrueの場合は、オブジェクトとその全パラメーターが必要です。 - `user.legal.address` (string) 最後まで記載した法的住所です。 - `user.legal.country` (string) 設立国。[ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)に従って大文字2文字の国コードを使用します。 - `user.legal.name` (string) 法人のフルネームです。 - `user.legal.vat_id` (string) 納税者個別のID。 - `user.name` (object) Example: {"value":"John Smith"} - `user.name.value` (string) ユーザーのスクリーン名。 Example: "John Smith" - `user.phone` (object) - `user.phone.value` (string) ユーザーの電話番号。 - `user.public_id` (object) - `user.public_id.value` (string) ユーザーを一意に識別し、ユーザーに知られているパラメーター(電子メール、スクリーン名など)。ユーザーがゲームストア外で購入することを可能にします(例えば、電子キオスクを介して)。 - `user.steam_id` (object) - `user.steam_id.value` (string) Steam ID。 - `user.tracking_id` (object) - `user.tracking_id.value` (string) 固有の追跡ID(マーケティングキャンペーンで使用)。 - `user.utm` (object) トラフィック属性(オブジェクト)。 - `user.utm.utm_campaign` (string) カタカナ表記、または英語に翻訳されたキャンペーンのタイトル。 - `user.utm.utm_content` (string) キャンペーンのコンテンツ。 - `user.utm.utm_medium` (string) トラフィックチャネル(コンテンツ広告、メディア広告、Eメールリストなど)。 - `user.utm.utm_source` (string) トラフィックソース。 - `user.utm.utm_term` (string) キャンペーンキーワード。設定すると、統計は特定の検索クエリではなく広告ターゲティングに使用されるキーワードに基づきます。Googleアナリティクスでは、指定されたutm_termは一般検索語句レポートの一部です。 ## Response 200 fields (application/json): - `token` (string) ## Response 422 fields (application/json): - `extended_message` (object) - `extended_message.global_errors` (array) - `extended_message.property_errors` (object) オブジェクトには、パラメータ名とエラー説明が含まれています。 - `http_status_code` (integer) - `message` (string) - `request_id` (string)