# 通过已保存的帐户收费

使用已保存的支付帐户收费。


注：在沙盒模式下，此API调用只适用于没有3-D Secure功能的测试银行卡。





注意为使API调用正常工作，请配置一个2分钟的超时时间。

Endpoint: POST /projects/{project_id}/users/{user_id}/payments/{type}/{account_id}
Version: 2.0
Security: basicAuth

## Path parameters:

  - `project_id` (integer, required)
    项目ID。

  - `user_id` (string, required)
    存储在己侧的游戏内唯一用户ID。请确保传入现有用户ID。如遇到错误，请参阅常见问题回答。

  - `type` (string, required)
    支付帐户类型。
    Enum: "card", "ais", "alipayplus_boost", "alipayplus_cn", "alipayplus_dana", "alipayplus_gcash", "alipayplus_hk", "alipayplus_kplus", "alipayplus_maya", "alipayplus_rabbitlinepay", "alipayplus_tng", "alipayplus_truemoney", "amazon", "klarna", "mercadopago", "nupay", "paidy", "paypal", "paysafecard_eu", "paysafecard_us", "skrill", "softbank_au", "softbank_docomo", "softbank_paypay", "softbank_softbank2", "softbank_ymobile", "toss"

  - `account_id` (integer, required)
    艾克索拉数据库中已保存的帐户的ID。

## Request fields (application/json):

  - `custom_parameters` (object)
    此对象包含配置防欺诈筛选条件的参数。参数列表如下所示。要添加自定义参数，请联系您的客户成功经理或发送邮件至[csm@xsolla.com](mailto:csm@xsolla.com)。

  - `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` (number)
    非高级货币数量。

  - `custom_parameters.notifications_enabled` (boolean)
    玩家是否启用了通知。

  - `custom_parameters.profile_completed` (boolean)
    玩家在帐户资料中是否添加了其它信息。

  - `custom_parameters.profile_image_added` (boolean)
    玩家是否上传了简介头像。

  - `custom_parameters.pvp_activity` (boolean)
    玩家是否参与了PvP（玩家对战）战斗。

  - `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` (number)
    库存总值（以游戏货币为单位）。

  - `custom_parameters.total_sum` (number)
    付款总额。

  - `custom_parameters.tutorial_completed` (boolean)
    玩家是否完成了游戏教程。

  - `custom_parameters.unlocked_achievements` (integer)
    未解锁的通关数。

  - `custom_parameters.user_level` (integer)
    玩家的等级、口碑或排名。

  - `custom_parameters.win_rate` (integer)
    赢率。

  - `purchase` (object)
    带有购买相关数据的对象。

  - `purchase.checkout` (object)
    带有结账参数相关数据的对象。

  - `purchase.checkout.amount` (number)
    购买金额。

  - `purchase.checkout.currency` (string)
    购买币种。参照[ISO 4217](https://developers.xsolla.com/zh/doc/pay-station/references/supported-currencies/)标准的三字母货币代码。

  - `purchase.description` (object)

  - `purchase.description.value` (string)

  - `purchase.virtual_currency` (object)
    带有虚拟货币相关数据的对象。

  - `purchase.virtual_currency.quantity` (number)
    使用虚拟货币购买的数量。

  - `settings` (object)
    带有购买设置相关数据的对象。

  - `settings.currency` (string)
    首选支付币种。参照[ISO 4217](https://developers.xsolla.com/zh/doc/pay-station/references/supported-currencies/)标准的三字母货币代码。

  - `settings.external_id` (string)
    游戏中的交易ID。该值对每个用户支付必须唯一。详细信息请参阅文档。

  - `settings.mock_code` (integer)
    在沙盒模式下测试PayPal支付处理时希望重现的错误代码。仅当传入了"mode":"sandbox"参数时才能正确工作。
    Enum: 1002, 1015, 1039, 1046, 1057, 1089, 1201, 1203, 1801, 1803, 2031, 3006, 3031, 5004

  - `settings.mode` (string)
    设置sandbox值以测试支付流程。对于真实支付，应移除此参数。

  - `user` (object)
    带用户相关数据的对象。

  - `user.ip` (string, required)
    用户IP。

  - `user.legal` (object)
    包含法律实体详细信息的对象。

  - `user.legal.address` (string)
    完整法定地址。

  - `user.legal.country` (string)
    公司所在国家/地区。参照[ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)标准的两个大写字母表示的国家/地区代码。

  - `user.legal.name` (string)
    完整法定名称。

  - `user.legal.vat_id` (string)
    个人纳税人识别号。

  - `user.name` (string)
    用户名。

## Response 201 fields (application/json):

  - `transaction_id` (integer)


## Response 422 fields
