Xsolla-logo
  • 文档
  • 创建帐户

创建令牌

post/merchants/{merchant_id}/token

You can create a token with arbitrary user parameters. You send these parameters when obtaining the token and receive them back after a successful payment. A token can only contain parameters either described in this document or predefined by you.

If any parameter is sent in the wrong format or has the wrong type, no token will be issued. You will receive a 422 HTTP code with the error description in the JSON body. In extended_message you will receive an information what exact parameters have been sent incorrectly.

Notice

This API call does not contain the project_id path-parameter, so you need to use the API key that is valid in all the company’s projects to set up authorization.

SecuritybasicAuth
Request
path Parameters
merchant_id
required
integer

商户ID。

Request Body schema: application/json
object

您可以在令牌的custom_parameters对象中传递其他参数以配置反欺诈筛选器。推荐参数在下拉列表中显示。请参阅支付中心文档

active_date
string

上一次出现日期(按照ISO 8601格式)。

additional_verification
boolean

玩家是否使用了帐户验证流程。

character_customized
boolean

玩家是否对角色进行了自定义。

chat_activity
boolean

玩家是否使用了聊天功能。

completed_tasks
integer

完成的任务/目标数。

forum_activity
boolean

玩家是否使用了论坛功能。

items_used
boolean

玩家是否使用了购买的游戏装备。

karma_points
integer

玩家的贡献/业力。

last_change_password_date
string

上一次出现日期(按照ISO 8601格式)。

non_premium_currency
integer <float>

非高级货币数量。

notifications_enabled
boolean

玩家是否启用了通知。

profile_completed
boolean

玩家在帐户资料中是否添加了其它信息。

profile_image_added
boolean

玩家是否上传了简介头像。

pvp_activity
boolean

玩家是否参与了玩家对战。

registration_date
string

上一次出现日期(按照ISO 8601格式)。

session_time
string

上一次出现日期(按照ISO 8601格式)。

social_networks_added
boolean

玩家是否有关联的社交媒体帐户资料。

total_bans
integer

玩家在聊天/论坛中被禁言的次数。

total_characters
integer

游戏角色数。

total_clans
integer

玩家所属的家族数。

total_friends
integer

好友数。

total_game_events
integer

玩家参与的游戏事件数。

total_gifts
integer

玩家发出/收到的游戏礼物数。

total_hours
integer

游戏总时数。

total_inventory_value
integer <float>

库存总值(以游戏货币为单位)。

total_sum
integer <float>

付款总额。

tutorial_completed
boolean

玩家是否完成了游戏教程。

unlocked_achievements
integer

未解锁的通关数。

user_level
integer

玩家的等级、口碑或排名。

win_rate
integer

赢率。

object

带有购买相关数据的对象。

object

带有结账参数相关数据的对象。

amount
integer <float>

购买金额。

currency
string

购买币种。参照ISO 4217标准的三字母货币代码。

object

带有订阅相关数据的对象。

available_plans
Array of strings

包含订阅套餐相关数据的数组。只有这些套餐会显示在支付用户界面中。

currency
string

购买计划的货币,以此币种进行所有计算。

object

赠礼订阅的详细信息。

recipient
required
string

接收者ID。

email
required
string

接收人邮箱。

anonymous
boolean

是否隐藏送礼人姓名。如为true,则在邮件通知中隐藏送礼人姓名。默认为false

message
string

给接收者的留言。

redirect_url
string

在此处提供包含赠礼订阅额外信息的页面链接或帐户创建页面的链接。收礼人可从订阅赠礼邮件通知中跳转到该页面。

operation
string

此操作的类型应用于用户订阅计划。要更改订阅计划,请传入change_plan值。需在purchase.subscription.plan_id参数中指定新计划的ID。

plan_id
string

订阅计划的外部ID。可在发布商帐户的订阅 > 订阅计划中找到。

product_id
string

产品ID。

trial_days
integer

试用期,以天为单位。

object

自定义项目设置。

project_id
required
integer

游戏的艾克索拉ID。可以在发布商帐户中找到该ID。

currency
string

首选支付币种。参照ISO 4217标准的三字母货币代码。

external_id
string

游戏中的交易ID。值对于每个用户付款必须唯一。

language
string

界面语言。2字母(小写字母)语言代码

mode
string

设置为sandbox值以测试支付流程。请使用https://sandbox-secure.xsolla.com来访问测试支付UI。

payment_method
integer

付款方式ID。

payment_widget
string

支付小部件。可以是 paybycashgiftcard。如果参数已设置,用户将分别重定向到 Pay by Cash 或 Gift Cards 小部件。

Enum: "paybycash" "giftcard"
object

重定向政策设置(对象)。

autoredirect_from_status_page
boolean

从状态页面自动重定向。

delay
integer

延迟时间(单位为秒),经过该时间后用户将自动重定向至返回URL。

manual_redirection_action
string

由用户点击关闭按钮或返回游戏按钮触发的支付中心行为。可以是redirect(默认)或postmessage。如果设置为redirect,则用户将被重定向至令牌中传入的URL或发布商帐户中指定的URL。如果设置为postmessage,则用户留在原页面。点击关闭按钮发起发送close事件,点击返回游戏则发起发送return事件。

Enum: "redirect" "postmessage"
redirect_button_caption
string

手动重定向按钮上的文字。

redirect_conditions
string

将用户重定向至返回URL的支付状态。可以是none, successful, successful_or_canсeledany

Enum: "none" "successful" "successful_or_canceled" "any"
status_for_manual_redirection
string

显示让用户重定向至返回URL按钮的支付状态。可以是none, successful, successful_or_canсeledany

Enum: "none" "successful" "successful_or_canceled" "any"
return_url
string

用户会在支付过后被重定向到此页面。参数user_idforeigninvoiceinvoice_idstatus会被自动添加到此链接。

object

带有界面设置相关数据的对象。

object

带有模块菜单设置相关数据的对象。

object

带有订阅模块设置相关数据的对象。

hidden
boolean

在菜单中显示还是隐藏“管理订阅”页面。

order
integer

虚拟物品在模块菜单中的排列顺序。

object

带有虚拟货币模块设置相关数据的对象。

custom_amount
boolean

是否允许在支付UI中输入任意数量的虚拟货币。

hidden
boolean

在菜单中显示还是隐藏“管理订阅”页面。

order
integer

虚拟物品在模块菜单中的排列顺序。

object

带有虚拟物品模块设置相关数据的对象。

hidden
boolean

在菜单中显示还是隐藏“管理订阅”页面。

order
integer

虚拟物品在模块菜单中的排列顺序。

selected_group
string

用户打开虚拟物品选项卡时将会选择的组。

selected_item
string

用户打开虚拟物品选项卡时将会选择的物品。物品 SKU 应发送至此处。

object

带有对桌面版本有效的界面设置相关数据的对象。

object

带有标题设置相关数据的对象。

close_button
boolean

是否在支付中心桌面端显示关闭按钮。该按钮将关闭支付中心并将用户重定向到settings.return_url参数中指定的URL。默认为false

is_visible
boolean

标题在支付 UI 上是否可见。

type
string

如何显示标题。不能为compact(隐藏项目名称和用户ID)或normal(默认)。

Enum: "compact" "normal"
visible_logo
boolean

如果为true,标题中将显示Logo(请先把Logo文件提供给您的客户成功经理)。

visible_name
boolean

标题中是否显示项目名称。

visible_purchase
boolean

是否在标题中显示购买描述(purchase.description.value)。默认为true

object

带有订阅列表设置相关数据的对象。

description
string

可以在此传递订阅相关的任意文本。文本将显示在订阅计划列表的上方。

display_local_price
boolean

如为true且如果用户的当地货币与订阅计划的货币不同,则用户将看到两种价格:以当地货币和基础货币标价的价格。

layout
string

订阅列表模式。可以是list(默认值)或grid

Enum: "list" "grid"
object

带有虚拟货币列表设置相关数据的对象。

button_with_price
boolean

如果为true,则价格会显示在按钮里。如果为false,则价格会显示在按钮左侧。默认值为false

description
string

可以在此传递虚拟货币列表相关的任意文本。文本将显示在虚拟货币包列表的上方。

object

带有虚拟物品列表设置相关数据的对象。

button_with_price
boolean

如果为true,则价格会显示在按钮里。如果为false,则价格会显示在按钮左侧。默认值为false

layout
string

订阅列表模式。可以是list(默认值)或grid

Enum: "list" "grid"
view
string

以垂直/水平菜单显示虚拟项目组。可以horizontal_navigationvertical_navigation(默认)。

Enum: "horizontal_navigation" "vertical_navigation"
object
visible_virtual_currency_balance
boolean

此元素是否可在支付UI上隐藏。默认为true

is_prevent_external_link_open
boolean

是否禁用将链接重定向至外部资源。默认为true。点击外部链接时,将通过postMessage机制发送external-link-open事件。重定向链接的地址在url参数中传递。

license_url
string

EULA的链接。

object
object
is_visible
boolean

是否在移动版本的支付UI中隐藏或显示脚注。

object
close_button
boolean

是否在支付中心移动端显示关闭按钮。该按钮将关闭支付中心并将用户重定向到settings.return_url参数中指定的URL。默认为false

mode
string

用户仅可以通过他们已保存的付款方式进行付款。可以为saved_accounts

Value: "saved_accounts"
mode
string

支付中心的界面模式。可能的值为user_account。请注意,页眉仅包含用户帐户的导航菜单,而没有用于选择产品或进行付款的任何选项。“用户帐户”仅在桌面模式下可用。

size
string

支付UI的大小。此参数可拥有以下值之一,具体取决于支付UI的所需大小:

  • small:支付UI支持的最小尺寸。当窗口大小严格受限时,请使用此值(尺寸:620 x 630)
  • medium:支付UI的推荐大小。使用此值可以在灯箱中显示支付UI(尺寸:740 x 760)
  • large:在新窗口或者选项卡中显示支付UI的最佳大小(尺寸:820 x 840)
Enum: "small" "medium" "large"
theme
string

支付UI的外观主题。可以是default(默认值)或default_dark

Enum: "default" "default_dark"
object

对象以及有关用户账号的数据。

object

历史记录子菜单。

enable
boolean

在菜单中显示还是隐藏“管理订阅”页面。默认值为false

order
integer

虚拟物品在模块菜单中的排列顺序。

object

我的账户页面。

enable
boolean

在菜单中显示还是隐藏“管理订阅”页面。默认值为false

order
integer

虚拟物品在模块菜单中的排列顺序。

object

保存的付款方法子菜单。

enable
boolean

在菜单中显示还是隐藏“管理订阅”页面。默认值为false

order
integer

虚拟物品在模块菜单中的排列顺序。

object

管理订阅子菜单。

enable
boolean

在菜单中显示还是隐藏“管理订阅”页面。默认值为false

order
integer

虚拟物品在模块菜单中的排列顺序。

version
string

设备的类型。可以是desktop(默认值)或mobile

Enum: "desktop" "mobile"
object

带用户相关数据的对象。

required
object
value
required
string

用户ID。

age
integer

用户年龄。

attributes
object

带有用户属性相关数据的对象,用于筛选物品列表。应当是带键值对的有效JSON哈希。

object
allow_modify
boolean

用户是否可以更改支付UI上的国家/地区。如果令牌中传入了country.value值,则值默认为false

value
string

使用ISO 3166-1 alpha-2标准规定的2字母组合表示国家/地区。

object

user.email对象是反欺诈模型的必要部分,有助于提高接受率。同时它也是艾克索拉和支付系统的要求。如果未传入该参数,支付页面将显示输入邮箱必填字段。购买凭证将发送至在该参数中传入的或在支付页面上输入的邮箱地址。

value
required
string

用户电子邮箱。必须符合RFC 822协议标准。

is_legal
boolean

用户是否为法律实体。

object

包含法律实体详细信息的对象。如果user.is_legaltrue,则对象及其所有参数为必需。

address
string

完整法定地址。

country
string

公司所在国家/地区。参照ISO 3166-1 alpha-2标准的两个大写字母表示的国家/地区代码。

name
string

完整法定名称。

vat_id
string

个人纳税人识别号。

object
value
string

用户昵称。

object
value
string

电话号码。

object
value
string

唯一识别用户并为用户所熟知的参数,与用户ID(电子邮件、昵称等)不同。此参数在可以在游戏商店以外进行购买时使用(如现金售货亭中的游戏按键)。

object
value
string

Steam ID。

object
value
string

唯一的跟踪ID(用于营销活动)。

object

对象包含描述流量特性的数据。

utm_campaign
string

活动标题。该参数应当包含直译的活动标题或者翻译为英文的活动标题。

utm_content
string

该活动的实质。

utm_medium
string

流量渠道(内容关联广告、媒体广告、邮件列表消息)。

utm_source
string

流量来源。

utm_term
string

活动关键词。在指定该参数的情况下,统计数据是基于在确定您的广告活动的目标对象过程中所使用的关键词数据而生成的,而不是基于检索项数据。在Google Analytics中,utm_term标签的内容成为包含检索项的综合报告中的一部分。

Responses
200

Created.

422

Unprocessable Entity.

Request samples
application/json
{
  • "purchase": {
    },
  • "settings": {
    },
  • "user": {
    }
}
Response samples
application/json
{
  • "token": "eop57k1boA7nnYPtewZ6KEXJyJADEwRT"
}