# 支付

当用户完成付款时，艾克索拉会向Webhook URL发送一个包含付款详细信息的payment类型的Webhook。

预期响应代码的说明见Responses 部分，您也可以使用其他响应代码：


    
    
        响应代码
        描述
    
    
    
    
        200、201、204
        成功的响应。
    
    
        4xx
        发生错误。例如，如果未找到指定的用户或传递了无效的签名。
    
    
        5xx
        服务器临时错误。收到此响应后，艾克索拉将自动重试发送Webhook，并逐渐增加尝试间隔，直到监听器确认接收。48小时内最多可重试12次。
    
    


在帐户中保存Webhook 
URL后，您还可以设置通过Webhook接收更多信息。


注：
如果是在2025年1月22日或之前注册的发布商帐户，可在项目中的设置 &gt; Webhooks &gt; 测试 &gt; 付款 &gt; 高级设置部分找到这些开关。




    
        开关
        描述
    


    
        显示保存的支付帐户的信息
        有关保存的支付方式的信息在payment_account自定义对象中传递。
    
    
        显示通过保存的支付方式进行的交易的信息
        信息在Webhook的以下自定义参数中传递：saved_payment_method:0 — 未使用保存的支付方式1 — 进行当前付款时保存了支付方式2 — 使用了之前保存的支付方式payment_type:1 — 一次性支付2 — 定期支付
    
    
        将订单对象添加到Webhook
        有关订单的信息在支付Webhook的order对象中传递。
    
    
        仅发送不含敏感数据的必要用户参数
        Webhook中仅传递用户的以下信息：ID国家/地区
    
    
        显示银行卡BIN和后缀码
        Webhook中传递以下银行卡号的信息：card_bin参数中的前6位数字card_suffix中的后4位数字
    
    
        显示银行卡品牌
        用于付款的银行卡的品牌。例如，Mastercard或Visa。
    
    
        显示国家/地区预扣税和用户获取费。
        payment_details.​country_wht和payment_details.​user_acquisition_fee对象将通过Webhook发送。此开关默认开启。
    
    
        发送3DS信息。
        包含3-D Secure验证数据的cards对象将通过Webhook发送。
    




注意
Webhook中发送的字段集取决于：在帐户中配置的高级设置在艾克索拉侧配置的自定义设置如果您有任何疑问，请联系您的客户成功经理或发送电子邮件至csm@xsolla.com。

Endpoint: POST payment
Version: 1.0

## Request fields (application/json):

  - `custom_parameters` (object)
    您的自定义参数。

  - `notification_type` (string, required)
    通知类型。

  - `payment_details` (object, required)
    带有支付详细信息的对象。

  - `payment_details.country_wht` (object)
    对象，包含因跨境交易而在具体国家/地区产生的预扣费用数据。

  - `payment_details.country_wht.amount` (number)
    金额。

  - `payment_details.country_wht.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.country_wht.percent` (number)
    预扣费用费率百分比。

  - `payment_details.direct_wht` (object)
    直接预扣税。

  - `payment_details.direct_wht.amount` (number)
    金额。

  - `payment_details.direct_wht.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.direct_wht.percent` (number)
    直接预扣税税率。

  - `payment_details.payment` (object)
    带有用户支付相关数据的对象。

  - `payment_details.payment.amount` (number)
    金额。

  - `payment_details.payment.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.payment_method_fee` (object)
    支付系统佣金的大小。

  - `payment_details.payment_method_fee.amount` (number)
    金额。

  - `payment_details.payment_method_fee.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.payment_method_sum` (object)
    带有通过支付方式收费的金额相关数据的对象。

  - `payment_details.payment_method_sum.amount` (number)
    金额。

  - `payment_details.payment_method_sum.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.payout` (object)
    带有支出详细信息的对象。

  - `payment_details.payout.amount` (number)
    金额。

  - `payment_details.payout.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.payout_currency_rate` (string)
    从支付币种到支出币种的汇率。

  - `payment_details.repatriation_commission` (object)
    包含汇回本国费用数据的对象，该费用是第三方对艾克索拉收取的费用。

  - `payment_details.repatriation_commission.amount` (number)
    金额。

  - `payment_details.repatriation_commission.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.sales_tax` (object)
    销售税（对象；仅适用于美国和加拿大）。

  - `payment_details.sales_tax.amount` (number)
    金额。

  - `payment_details.sales_tax.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.sales_tax.percent` (number)
    销售税税率。

  - `payment_details.user_acquisition_fee` (object)
    从通过联盟网络和圈内达人完成的购买中扣除的用户获取费用总额（对象）。

  - `payment_details.user_acquisition_fee.amount` (number)
    金额。

  - `payment_details.user_acquisition_fee.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.user_acquisition_fee.percent` (number)
    用户获取费费率(%)。

  - `payment_details.vat` (object)
    增值税大小（仅适用于欧盟）。

  - `payment_details.vat.amount` (number)
    金额。

  - `payment_details.vat.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.vat.percent` (number)
    VAT税率。

  - `payment_details.xsolla_balance_sum` (object)
    计入艾克索拉余额的金额。

  - `payment_details.xsolla_balance_sum.amount` (number)
    金额。

  - `payment_details.xsolla_balance_sum.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `payment_details.xsolla_fee` (object)
    艾克索拉费用（对象）。

  - `payment_details.xsolla_fee.amount` (number)
    金额。

  - `payment_details.xsolla_fee.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

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

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

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

  - `purchase.checkout.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `purchase.coupon` (object)
    带有优惠券相关数据的对象（如果此交易使用了优惠券）。

  - `purchase.coupon.campaign_code` (string)
    优惠券营销活动的代码。

  - `purchase.coupon.coupon_code` (string)
    优惠券代码。

  - `purchase.gift` (object)
    礼物详情（对象）。

  - `purchase.gift.giver_id` (string)
    送礼人ID。

  - `purchase.gift.hide_giver_from_receiver` (string)
    是否对收礼人隐藏送礼人的身份信息。

  - `purchase.gift.message` (string)
    送礼人留言。

  - `purchase.gift.receiver_email` (string)
    收礼人邮箱。

  - `purchase.gift.receiver_id` (string)
    收礼人ID。

  - `purchase.order` (object)
    包含订单信息的对象。如需接收这些信息，请在[帐户](/zh/webhooks/overview/#business-accounts)的设置 > Webhook > 高级设置部分中启用将订单对象添加到Webhook开关。

  - `purchase.order.id` (integer)
    订单ID。

  - `purchase.order.lineitems` (array)
    包含商品信息的参数数组。

  - `purchase.order.lineitems.price` (object)
    包含商品价格信息的对象。

  - `purchase.order.lineitems.price.amount` (number)
    商品在所选货币下的总价。

  - `purchase.order.lineitems.price.currency` (string)
    商品价格的货币单位。

  - `purchase.order.lineitems.quantity` (integer)
    商品数量。

  - `purchase.order.lineitems.sku` (string)
    商品SKU。

  - `purchase.promotions` (array)
    应用于此交易的促销活动。

  - `purchase.promotions.id` (integer)
    促销活动 ID。

  - `purchase.promotions.technical_name` (string)
    促销活动的技术名称。

  - `purchase.subscription` (object)
    订阅详情（对象）。

  - `purchase.subscription.amount` (number)
    以实际货币表示的价格。

  - `purchase.subscription.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `purchase.subscription.date_create` (string)
    订阅的创建日期。符合 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)标准规定的日期与时间。

  - `purchase.subscription.date_next_charge` (string)
    下次收费的日期。符合[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)标准规定的日期与时间。

  - `purchase.subscription.plan_id` (string)
    计划ID（如果计划通过API创建，则为外部ID）。

  - `purchase.subscription.product_id` (string)
    产品ID（如果在访问令牌中发送）。

  - `purchase.subscription.subscription_id` (integer)
    艾克索拉数据库的订阅ID。

  - `purchase.subscription.tags` (array)
    计划标签。

  - `purchase.total` (object, required)
    带有总购买价格相关数据的对象。

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

  - `purchase.total.currency` (string)
    货币。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)的三字母货币代码。

  - `settings` (object)
    带有自定义项目设置的对象。

  - `settings.merchant_id` (integer)
    商户ID。

  - `settings.project_id` (integer)
    项目ID。您可以在[帐户](/zh/webhooks/overview/#business-accounts)中项目名称旁找到该参数。

  - `transaction` (object, required)
    交易ID。

  - `transaction.agreement` (integer)
    协议ID。

  - `transaction.dry_run` (integer)
    测试交易。如为测试交易，该参数的值为1；如为真实交易，则不会发送该参数。

  - `transaction.external_id` (string)
    交易外部ID。详细信息请参阅[常见问答](/zh/doc/pay-station/references/faq/#faq_payments_q_new_transaction_external_id)。

  - `transaction.id` (integer)
    交易ID。

  - `transaction.payment_date` (string)
    付款日期。

  - `transaction.payment_method` (integer)
    付款方式ID。

  - `transaction.payment_method_name` (string)
    付款方式名称。

  - `transaction.payment_method_order_id` (string)
    支付系统中的付款ID。

  - `user` (object)
    用户详情（对象）。

  - `user.country` (string)
    用户所在国家/地区。使用[ISO 3166-1 alpha-2 标准](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)规定的2字母组合表示国家/地区。

  - `user.email` (string)
    用户电子邮件。

  - `user.id` (string, required)
    用户ID。

  - `user.ip` (string)
    用户 IP 地址。

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

  - `user.phone` (string)
    用户电话号码（采用国际格式）。

  - `user.zip` (string)
    邮编。

## Response 400 fields (application/json):

  - `error` (object)

  - `error.code` (string)

  - `error.message` (string)


## Response 204 fields

## Response 500 fields
