# 使用指定商品创建订单 用于客户端到服务器的集成。使用指定商品创建订单并为其生成支付令牌。创建的订单得到new订单状态。 客户端IP用于确定用户所在的国家/地区,然后用于为订单应用相应的货币和可用的支付方式。 要在新窗口中打开支付UI,请使用以下链接:https://secure.xsolla.com/paystation4/?token={token} ,其中{token}是收到的令牌。 如要进行测试,请使用以下URL:https://sandbox-secure.xsolla.com/paystation4/?token={token}。 注:由于此方法使用IP来确定用户所在的国家/地区并为订单选择货币,因此必须从客户端而不是从服务器端使用此方法。从服务器端使用此方法可能会导致货币判断错误并影响支付中心中可用的支付方式。 Endpoint: POST /v2/project/{project_id}/payment/item/{item_sku} Version: 2.0.0 Security: XsollaLoginUserJWT ## Path parameters: - `project_id` (integer, required) 项目ID。您可以在您的发布商帐户项目名称旁边找到。 Example: 44056 - `item_sku` (string, required) 商品SKU。 Example: "booster_mega_1" ## Request fields (application/json): - `currency` (string) 订单价格货币。每笔订单的三个字母的货币代码[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)。请查看文档以获取有关[Xsolla 支持的货币](https://developers.xsolla.com/zh/doc/pay-station/references/supported-currencies/)。 - `custom_parameters` (object) 项目特定参数。 - `locale` (string) 响应语言。 - `promo_code` (string) 随支付兑换促销码活动代码。 - `quantity` (integer) 商品数量。 - `sandbox` (boolean) 在沙盒模式下创建订单。该选项适用于公司用户列表中指定的那些用户。 - `settings` (object) 为用户配置支付流程和支付UI的设置。 - `settings.payment_method` (integer) 支付方式ID,它决定支付界面显示的货币,因为有些支付方式可能只支持某些特定的货币。 - `settings.redirect_policy` (object) - `settings.redirect_policy.delay` (integer) 经过指定延迟时间后自动将用户重定向到返回URL。 - `settings.redirect_policy.redirect_button_caption` (string) 本地化的重定向按钮文字。 Example: "Text button" - `settings.redirect_policy.redirect_conditions` (string) 触发将用户重定向到返回URL的支付状态。 Enum: "none", "successful", "successful_or_canceled", "any" - `settings.redirect_policy.status_for_manual_redirection` (string) 触发显示重定向按钮的支付状态,用户单击该按钮后将被重定向到返回URL。 Enum: "none", "vc", "successful", "successful_or_canceled", "any" - `settings.return_url` (string) 用户会在支付过后被重定向到此页面。参数user_id、foreigninvoice、invoice_id和status会被自动添加到此链接。 - `settings.ui` (object) 界面设置。 - `settings.ui.currency_format` (string) 设置为code以在支付UI中显示三字母的[ISO 4217](https://developers.xsolla.com/zh/doc/pay-station/references/supported-currencies/)货币代码。默认显示货币符号而不是三字母货币代码。 - `settings.ui.desktop` (object) 桌面版本的界面设置。 - `settings.ui.desktop.header` (object) 页眉设置。 - `settings.ui.desktop.header.close_button` (boolean) 是否在桌面支付UI中显示关闭按钮。该按钮将关闭支付UI并将用户重定向到settings.return_url参数中指定的URL。默认为false。 - `settings.ui.desktop.header.is_visible` (boolean) 页眉在支付UI上是否可见。 - `settings.ui.desktop.header.type` (string) 如何显示页眉。不能为compact(隐藏项目名称和用户ID)或normal(默认)。 Enum: "compact", "normal" - `settings.ui.desktop.header.visible_logo` (boolean) 如果true,徽标将显示在标题中。要上传图像,请在[发布者帐户](https://publisher.xsolla.com/)然后转到付款站 > 设置部分。 - `settings.ui.desktop.header.visible_name` (boolean) 页眉中是否显示项目名称。 - `settings.ui.desktop.header.visible_purchase` (boolean) 是否在页眉中显示购买描述(purchase.description.value)。默认为true。 - `settings.ui.header` (object) - `settings.ui.header.visible_virtual_currency_balance` (boolean) 此元素是否可在支付UI上隐藏。 - `settings.ui.is_cart_open_by_default` (boolean) 打开支付UI移动版本时购物车商品列表的显示方式。如为true,列表以扩展视图显示。如为false(默认)或未传入此参数,列表以折叠视图显示。 - `settings.ui.is_independent_windows` (boolean) 是否将用户从嵌入式启动器浏览器(WebView)跳转到其默认的浏览器来进行购买。 - `settings.ui.is_payment_methods_list_mode` (boolean) 打开支付UI时是否显示在该用户所在国家/地区可用的支付方式。如为false(默认),将显示在settings.payment_method参数中传入的支付方式或[PayRank算法](https://developers.xsolla.com/zh/solutions/payments/payment-ui-management/top-payment-methods-management/)选择的支付方式。 - `settings.ui.is_prevent_external_link_open` (boolean) 是否禁用将链接重定向至外部资源。点击外部链接时,将通过postMessage机制发送external-link-open事件。重定向链接的地址在url参数中传递。 - `settings.ui.is_show_close_widget_warning` (boolean) 关闭支付页面前鼠标悬停在×图标时是否显示交易正在处理中的警告。如传入false,或未传入参数,则不显示警告。 - `settings.ui.is_three_ds_independent_windows` (boolean) 是否在新浏览器窗口中打开3-D Secure检查。如果您的设置强制执行内容安全政策(CSP),请设置为true。 - `settings.ui.layout` (string) 支付UI主要元素的位置。您可以在游戏内打开支付UI和/或交换订单信息和支付方式信息列的位置。详细信息请参阅[自定义说明](https://developers.xsolla.com/zh/doc/pay-station/features/ui-theme-customization/#pay_station_ui_theme_customization_layout)。 Enum: "embed", "column_reverse", "embed_column_reverse" - `settings.ui.mobile` (object) - `settings.ui.mode` (string) 支付UI的界面模式。只能是user_account。请注意,页眉仅包含用户帐户的导航菜单,而没有用于选择产品或进行付款的任何选项。“用户帐户”仅在桌面模式下可用。 Enum: "user_account" - `settings.ui.theme` (string) 支付UI主题。可以是63295a9a2e47fab76f7708e1(浅色主题(默认)),或63295aab2e47fab76f7708e3(深色主题)。您也可以[创建自定义主题](https://developers.xsolla.com/zh/doc/pay-station/features/ui-theme-customization/#pay_station_ui_theme_customization_in_token),然后在此参数中传入其ID。 Enum: "63295a9a2e47fab76f7708e1", "63295aab2e47fab76f7708e3" - `settings.ui.user_account` (object) 用户帐户详细信息。 - `settings.ui.user_account.info` (object) 我的账户页面。 - `settings.ui.user_account.info.enable` (boolean, required) 是否显示子菜单。默认为false。 - `settings.ui.user_account.info.order` (integer, required) 子菜单在菜单中的位置。 - `settings.ui.user_account.payment_accounts` (object) 我的支付帐户子菜单。 - `settings.ui.user_account.subscriptions` (object) 管理订阅子菜单。 ## Response 200 fields (application/json): - `order_id` (integer) 订单ID。 - `token` (string) 支付令牌。 ## Response 404 fields (application/json): - `errorCode` (integer) - `errorMessage` (string) - `statusCode` (integer) - `transactionId` (string) ## Response 422 fields (application/json): - `errorCode` (integer) Example: 1411 - `errorMessage` (string) Example: "[0401-1411]: Invalid item" - `statusCode` (integer) Example: 422