退款申请 
当交易发生之后一段时间内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付款退还给买家,微信支付将在收到退款请求并且验证成功之后,按照退款规则将支付款按原路退到买家帐号上。
| 请求参数 | 类型 | 描述 | 
|---|---|---|
| json | object | 声明请求的 JSON数据结构 | 
| individual_auth_id | string | 商品单个人收款方受理授权ID | 
| sub_mchid | string | 二级商户号 | 
| sp_appid | string | 电商平台APPID | 
| sub_appid | string | 二级商户APPID | 
| combine_mchid | string | 还款服务商商户号 | 
| combine_out_trade_no | string | 还款订单号 | 
| combine_transaction_id | string | 交易单微信支付订单号 | 
| transaction_id | string | 微信订单号 | 
| out_trade_no | string | 商户订单号 | 
| out_refund_no | string | 商户退款单号 | 
| reason | string | 退款原因 | 
| amount | object | 订单金额 | 
| refund | integer | 退款金额 | 
| from | object[] | 退款出资账户及金额 | 
| account | string | 出资账户类型 AVAILABLE|UNAVAILABLE枚举值之一 | 
| amount | number | 出资金额 | 
| total | integer | 原订单金额 | 
| currency | string | 退款币种 | 
| notify_url | string | 退款结果回调url | 
| refund_account | string | 退款出资商户 REFUND_SOURCE_SUB_MERCHANT|REFUND_SOURCE_PARTNER_ADVANCE枚举值之一 | 
| funds_account | string | 资金账户 AVAILABLE|UNSETTLED枚举值之一 | 
php
$instance->v3->ecommerce->refunds->apply->postAsync([
  'json' => [
    'individual_auth_id'     => '1900000109',
    'sub_mchid'              => '1900000109',
    'sp_appid'               => 'wx8888888888888888',
    'sub_appid'              => 'wx8888888888888888',
    'combine_mchid'          => '1230000109',
    'combine_out_trade_no'   => 'P20150806125346',
    'combine_transaction_id' => '1217752501201407033233368018',
    'transaction_id'         => '1217752501201407033233368018',
    'out_trade_no'           => '1217752501201407033233368018',
    'out_refund_no'          => '1217752501201407033233368018',
    'reason'                 => '商品已售完',
    'amount'                 => [
      'refund'   => 888,
      'from'     => [[
        'account' => 'AVAILABLE',
        'amount'  => 444,
      ],],
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'notify_url'             => 'https://weixin.qq.com',
    'refund_account'         => 'REFUND_SOURCE_SUB_MERCHANT',
    'funds_account'          => 'AVAILABLE',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/ecommerce/refunds/apply')->postAsync([
  'json' => [
    'individual_auth_id'     => '1900000109',
    'sub_mchid'              => '1900000109',
    'sp_appid'               => 'wx8888888888888888',
    'sub_appid'              => 'wx8888888888888888',
    'combine_mchid'          => '1230000109',
    'combine_out_trade_no'   => 'P20150806125346',
    'combine_transaction_id' => '1217752501201407033233368018',
    'transaction_id'         => '1217752501201407033233368018',
    'out_trade_no'           => '1217752501201407033233368018',
    'out_refund_no'          => '1217752501201407033233368018',
    'reason'                 => '商品已售完',
    'amount'                 => [
      'refund'   => 888,
      'from'     => [[
        'account' => 'AVAILABLE',
        'amount'  => 444,
      ],],
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'notify_url'             => 'https://weixin.qq.com',
    'refund_account'         => 'REFUND_SOURCE_SUB_MERCHANT',
    'funds_account'          => 'AVAILABLE',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/ecommerce/refunds/apply']->postAsync([
  'json' => [
    'individual_auth_id'     => '1900000109',
    'sub_mchid'              => '1900000109',
    'sp_appid'               => 'wx8888888888888888',
    'sub_appid'              => 'wx8888888888888888',
    'combine_mchid'          => '1230000109',
    'combine_out_trade_no'   => 'P20150806125346',
    'combine_transaction_id' => '1217752501201407033233368018',
    'transaction_id'         => '1217752501201407033233368018',
    'out_trade_no'           => '1217752501201407033233368018',
    'out_refund_no'          => '1217752501201407033233368018',
    'reason'                 => '商品已售完',
    'amount'                 => [
      'refund'   => 888,
      'from'     => [[
        'account' => 'AVAILABLE',
        'amount'  => 444,
      ],],
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'notify_url'             => 'https://weixin.qq.com',
    'refund_account'         => 'REFUND_SOURCE_SUB_MERCHANT',
    'funds_account'          => 'AVAILABLE',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->ecommerce->refunds->apply->post([
  'json' => [
    'individual_auth_id'     => '1900000109',
    'sub_mchid'              => '1900000109',
    'sp_appid'               => 'wx8888888888888888',
    'sub_appid'              => 'wx8888888888888888',
    'combine_mchid'          => '1230000109',
    'combine_out_trade_no'   => 'P20150806125346',
    'combine_transaction_id' => '1217752501201407033233368018',
    'transaction_id'         => '1217752501201407033233368018',
    'out_trade_no'           => '1217752501201407033233368018',
    'out_refund_no'          => '1217752501201407033233368018',
    'reason'                 => '商品已售完',
    'amount'                 => [
      'refund'   => 888,
      'from'     => [[
        'account' => 'AVAILABLE',
        'amount'  => 444,
      ],],
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'notify_url'             => 'https://weixin.qq.com',
    'refund_account'         => 'REFUND_SOURCE_SUB_MERCHANT',
    'funds_account'          => 'AVAILABLE',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/ecommerce/refunds/apply')->post([
  'json' => [
    'individual_auth_id'     => '1900000109',
    'sub_mchid'              => '1900000109',
    'sp_appid'               => 'wx8888888888888888',
    'sub_appid'              => 'wx8888888888888888',
    'combine_mchid'          => '1230000109',
    'combine_out_trade_no'   => 'P20150806125346',
    'combine_transaction_id' => '1217752501201407033233368018',
    'transaction_id'         => '1217752501201407033233368018',
    'out_trade_no'           => '1217752501201407033233368018',
    'out_refund_no'          => '1217752501201407033233368018',
    'reason'                 => '商品已售完',
    'amount'                 => [
      'refund'   => 888,
      'from'     => [[
        'account' => 'AVAILABLE',
        'amount'  => 444,
      ],],
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'notify_url'             => 'https://weixin.qq.com',
    'refund_account'         => 'REFUND_SOURCE_SUB_MERCHANT',
    'funds_account'          => 'AVAILABLE',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/ecommerce/refunds/apply']->post([
  'json' => [
    'individual_auth_id'     => '1900000109',
    'sub_mchid'              => '1900000109',
    'sp_appid'               => 'wx8888888888888888',
    'sub_appid'              => 'wx8888888888888888',
    'combine_mchid'          => '1230000109',
    'combine_out_trade_no'   => 'P20150806125346',
    'combine_transaction_id' => '1217752501201407033233368018',
    'transaction_id'         => '1217752501201407033233368018',
    'out_trade_no'           => '1217752501201407033233368018',
    'out_refund_no'          => '1217752501201407033233368018',
    'reason'                 => '商品已售完',
    'amount'                 => [
      'refund'   => 888,
      'from'     => [[
        'account' => 'AVAILABLE',
        'amount'  => 444,
      ],],
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'notify_url'             => 'https://weixin.qq.com',
    'refund_account'         => 'REFUND_SOURCE_SUB_MERCHANT',
    'funds_account'          => 'AVAILABLE',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 | 
|---|---|---|
| refund_id | string | 微信退款单号 | 
| out_refund_no | string | 商户退款单号 | 
| create_time | string | 退款创建时间 | 
| amount | object | 订单金额 | 
| refund | integer | 退款金额 | 
| from | object[] | 退款出资账户及金额 | 
| account | string | 出资账户类型 | 
| amount | number | 出资金额 | 
| payer_refund | integer | 用户退款金额 | 
| discount_refund | integer | 优惠退款金额 | 
| currency | string | 退款币种 | 
| advance | number | 垫付金额 | 
| promotion_detail | object[] | 优惠退款详情 | 
| promotion_id | string | 券ID | 
| scope | string | 优惠范围 | 
| type | string | 优惠类型 | 
| amount | integer | 优惠券面额 | 
| refund_amount | integer | 优惠退款金额 | 
| refund_account | string | 退款出资商户 REFUND_SOURCE_SUB_MERCHANT|REFUND_SOURCE_PARTNER_ADVANCE枚举值之一 |