Xsolla-logo
  • 文档
  • 创建帐户

订单取消(包含付款和交易详情)Webhook POST

当付款被用户、合作伙伴或自动取消时,艾克索拉发送order_canceled webhook到指定的URL。

order_canceled webhook包含退货商品、付款信息和取消的交易的详细信息。

如果付款不成功,则不会发送order_canceled webhook,例如:

  • 打开了支付表单,但用户没有为订单付款
  • 打开了支付表单,但付款过程中出现错误

建议order_canceled webhook的处理时间小于3秒。

Request
Request Body schema: application/json
notification_type
required
string

通知类型。

required
Array of version = 1 (object) or version = 2 (object)

用户所购商品的列表。

The set of parameters included in the array depends on the webhook version. Version 2 includes additional parameters: is_free, is_bonus, and is_bundle_content. To switch the version, pass its number in the version parameter in the Update information about webhook settings API call.

Array
One of:
sku
required
string

项目的唯一ID。对于game_key类型的商品,使用sku_drm格式的值。

type
required
string

商品类型。它可以具有以下值:virtual_goodvirtual_currencygame_keybundle。对于bundle类型的商品(包括虚拟货币套餐),商品数组将显示:

  • 捆绑包或虚拟货币套餐的参数
  • 捆绑包中包含的商品或套餐中包含的货币
Enum: "virtual_good" "virtual_currency" "game_key" "bundle"
quantity
required
integer

商品数量。

amount
required
string

根据商品数量计算的总费用。

required
Array of objects

应用促销。如果未应用促销,则会在参数中传递一个空数组。

Array
amount_with_discount
string

应用折扣后商品总价。

amount_without_discount
string

不应用折扣的商品总价。

sequence
integer

应用促销活动的顺序。

is_pre_order
required
boolean

如果为true,则该商品为预订商品。

custom_attributes
object

包含商品属性和值的JSON对象。

required
object

订单信息。

id
required
integer

艾克索拉侧用户订单的唯一标识符。

mode
required
string

付款模式。对于真实支付,使用default;对于测试性支付,使用sandbox

Enum: "default" "sandbox"
currency_type
required
string

支付货币类型。对于免费订单,则值指定为unknown

Enum: Description
real

对于真实货币

unknown

对于免费订单

virtual

对于虚拟货币

currency
required
string

订单货币。虚拟货币使用SKU,真实货币使用三个字母的ISO 4217代码。

amount
required
string

基于所选货币的购物车总价。

status
required
string

订单状态。

platform
required
string or null

支付平台。 xsolla值用于通过艾克索拉进行的支付。其他支付使用游戏发布平台名称对应的值:playstation_networkxbox_livepc_standalonenintendo_shopgoogle_playapp_store_iosandroid_standaloneios_standaloneandroid_otherios_otherpc_other

Enum: "xsolla" "playstation_network" "xbox_live" "pc_standalone" "nintendo_shop" "google_play" "app_store_ios" "android_standalone" "ios_standalone" "android_other" "ios_other" "pc_other"
comment
required
string or null

用户对订单的备注。

invoice_id
required
string or null

实际货币付款发票ID。虚拟货币付款或免费商品的值为null

required
Array of objects

应用促销。如果未应用促销,则会在参数中传递一个空数组。

Array
amount_with_discount
string

应用折扣后商品总价。

amount_without_discount
string

不应用折扣的商品总价。

sequence
integer

应用促销活动的顺序。

Array of objects

应用的优惠券。如未应用优惠券,则不会返回该数组。

Array
code
string

应用的优惠券的券码。

external_id
string

外部ID。

Array of objects

应用的促销码。如未应用促销码,则不会返回该数组。

Array
code
string

应用的促销码的代码。

external_id
string

外部ID。

required
object

用户信息。

external_id
required
string

用户ID。

email
required
string

用户邮箱地址。

object

交易和付款详细信息。

notification_type
required
string

通知类型。

required
object

交易ID。

agreement
integer

协议ID。

dry_run
integer

测试交易。如为测试交易,该参数的值为1;如为真实交易,则不会发送该参数。

external_id
string

交易外部ID。

id
integer

交易ID。

payment_method_order_id
string

支付系统中的付款ID。

required
object

带有支付详细信息的对象。

object

跨境交易在特定国家/地区收取的预扣税(对象)。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

percent
number <float>

国家/地区预扣税税率(%)。

object

直接预扣税。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

percent
number <float>

直接预扣税税率。

object

带有用户支付相关数据的对象。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

object

支付系统佣金的大小。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

object

带有通过支付方式收费的金额相关数据的对象。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

object

带有支出详细信息的对象。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

payout_currency_rate
string

从支付币种到支出币种的汇率。

object

包含汇回本国费用数据的对象,该费用是第三方对艾克索拉收取的费用。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

object

销售税(对象;仅适用于美国和加拿大)。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

percent
number <float>

销售税税率。

object

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

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

percent
number <float>

用户获取费费率(%)。

object

增值税大小(仅适用于欧盟)。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

percent
number <float>

VAT税率。

object

计入艾克索拉余额的金额。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

object

艾克索拉费用(对象)。

amount
number <float>

金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

object

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

required
object

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

amount
number <float>

总购买金额。

currency
string

货币。符合ISO 4217的三字母货币代码。

object

订阅详情(对象)。

amount
number <float>

以实际货币表示的价格。

currency
string

货币。符合ISO 4217的三字母货币代码。

date_create
string

订阅的创建日期。符合 ISO 8601标准规定的日期与时间。

plan_id
string

计划ID(如果计划通过API创建,则为外部ID)。

subscription_id
integer

艾克索拉数据库的订阅ID。

tags
Array of strings

计划标签。

object

退款详情(对象)。

author
string

退款发起人。根据下表传入字段值:

退款发起人 字段值
游戏(通过API)。 API
发布商帐户用户(自动退款)。 用户邮箱
发布商帐户用户(通过艾克索拉客户支持的帮助)。 support@xsolla.com
艾克索拉(通过艾克索拉客户支持的帮助)。 support@xsolla.com
code
integer

代码ID。

reason
string

退款原因。

object

带有自定义项目设置的对象。

merchant_id
integer

商户ID。

project_id
integer

项目编号。您可以在您的发布商帐户项目名称旁边。

custom_parameters
object

附加信息。

Responses
200

返回以指示处理成功。

400

提供的信息出错时返回(例如,缺少必需的参数、授权失败等)。

Request samples
curl -v 'https://your.hostname/your/uri' \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Signature d09695066c52c1b8bdae92f2d6eb59f5b5f89843' \
-d '{
    "notification_type": "order_canceled",
    "items": [
      {
        "sku": "com.xsolla.v.item_1",
        "type": "virtual_good",
        "is_pre_order": false,
        "quantity": 3,
        "amount": "1000",
        "promotions": [
          {
            "amount_without_discount": "6000",
            "amount_with_discount": "5000",
            "sequence": 1
          },
          {
            "amount_without_discount": "5000",
            "amount_with_discount": "4000",
            "sequence": 2
          }
        ],
        "custom_attributes": {
            "purchased": 0,
            "attr": "value"
          }
      },
      {
        "sku": "com.xsolla.v.item_new_1",
        "type": "bundle",
        "is_pre_order": false,
        "quantity": 1,
        "amount": "1000",
        "promotions": []
      },
      {
        "sku": "com.xsolla.gold_1",
        "type": "virtual_currency",
        "is_pre_order": false,
        "quantity": 1500,
        "amount": "[null]",
        "promotions": []
      }
    ],
    "order": {
      "id": 1,
      "mode": "default",
      "currency_type": "virtual",
      "currency": "sku_currency",
      "amount": "2000",
      "status": "paid",
      "platform": "xsolla",
      "comment": null,
      "invoice_id": "1",
      "promotions": [
        {
          "amount_without_discount": "4000",
          "amount_with_discount": "2000",
          "sequence": 1
        }
      ],
      "promocodes": [
        {
          "code": "promocode_some_code",
          "external_id": "promocode_sku"
        }
      ],
      "coupons": [
        {
          "code": "WINTER2021",
          "external_id": "coupon_sku"
        }
      ]
    },
    "user": {
      "external_id": "id_xsolla_login_1",
      "email": "email@example.com"
    },
    "billing": {
      "notification_type": "refund",
      "settings": {
        "project_id": 18404,
        "merchant_id": 2340
      },
      "purchase": {
              "subscription": {
                  "plan_id": "b5dac9c8",
                  "subscription_id": "10",
                  "date_create": "2014-09-22T19:25:25+04:00",
                  "currency": "USD",
                  "amount": 9.99
              },
              "total":{
                  "currency": "USD",
                  "amount": 200
              }
          },
      "transaction": {
              "id": 1,
              "external_id": 1,
              "dry_run": 1,
              "agreement": 1
          },
      "refund_details": {
              "code": 4,
              "reason": "Potential fraud"
          },
      "payment_details": {
              "sales_tax": {
                  "currency": "USD",
                  "amount": 0
              },
              "direct_wht": {
                  "currency": "USD",
                  "amount": 0.70
              },
              "xsolla_fee": {
                  "currency": "USD",
                  "amount": "10"
              },
              "payout": {
                  "currency": "USD",
                  "amount": "200"
              },
              "payment_method_fee": {
                  "currency": "USD",
                  "amount": "20"
              },
              "payment": {
                  "currency": "USD",
                  "amount": "230"
              },
              "repatriation_commission": {
                  "currency": "USD",
                  "amount": 10
              }
          }
    }
}'