申请退款
当交易发生之后一年内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付金额退还给买家,微信支付将在收到退款请求并且验证成功之后,将支付款按原路退还至买家账号上。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
sub_mchid | string | 子商户号 |
transaction_id | string | 微信支付订单号 |
out_trade_no | string | 商户订单号 |
out_refund_no | string | 商户退款单号 |
reason | string | 退款原因 |
notify_url | string | 退款结果回调url |
funds_account | string | 退款资金来源 |
amount | object | 金额信息 |
refund | integer | 退款金额 |
from | object[] | 退款出资账户及金额 |
account | string | 出资账户类型 |
amount | integer | 出资金额 |
total | integer | 原订单金额 |
currency | string | 退款币种 |
goods_detail | object[] | 退款商品 |
merchant_goods_id | string | 商户侧商品编码 |
wechatpay_goods_id | string | 微信侧商品编码 |
goods_name | string | 商品名称 |
unit_price | integer | 商品单价 |
refund_amount | integer | 商品退款金额 |
refund_quantity | integer | 商品退货数量 |
php
$instance->v3->refund->domestic->refunds->postAsync([
'json' => [
'sub_mchid' => '1900000109',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'out_refund_no' => '1217752501201407033233368018',
'reason' => '商品已售完',
'notify_url' => 'https://weixin.qq.com',
'funds_account' => 'AVAILABLE',
'amount' => [
'refund' => 888,
'from' => [[
'account' => 'AVAILABLE',
'amount' => 444,
],],
'total' => 888,
'currency' => 'CNY',
],
'goods_detail' => [[
'merchant_goods_id' => '1217752501201407033233368018',
'wechatpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'unit_price' => 528800,
'refund_amount' => 528800,
'refund_quantity' => 1,
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/refund/domestic/refunds')->postAsync([
'json' => [
'sub_mchid' => '1900000109',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'out_refund_no' => '1217752501201407033233368018',
'reason' => '商品已售完',
'notify_url' => 'https://weixin.qq.com',
'funds_account' => 'AVAILABLE',
'amount' => [
'refund' => 888,
'from' => [[
'account' => 'AVAILABLE',
'amount' => 444,
],],
'total' => 888,
'currency' => 'CNY',
],
'goods_detail' => [[
'merchant_goods_id' => '1217752501201407033233368018',
'wechatpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'unit_price' => 528800,
'refund_amount' => 528800,
'refund_quantity' => 1,
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/refund/domestic/refunds']->postAsync([
'json' => [
'sub_mchid' => '1900000109',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'out_refund_no' => '1217752501201407033233368018',
'reason' => '商品已售完',
'notify_url' => 'https://weixin.qq.com',
'funds_account' => 'AVAILABLE',
'amount' => [
'refund' => 888,
'from' => [[
'account' => 'AVAILABLE',
'amount' => 444,
],],
'total' => 888,
'currency' => 'CNY',
],
'goods_detail' => [[
'merchant_goods_id' => '1217752501201407033233368018',
'wechatpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'unit_price' => 528800,
'refund_amount' => 528800,
'refund_quantity' => 1,
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->refund->domestic->refunds->post([
'json' => [
'sub_mchid' => '1900000109',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'out_refund_no' => '1217752501201407033233368018',
'reason' => '商品已售完',
'notify_url' => 'https://weixin.qq.com',
'funds_account' => 'AVAILABLE',
'amount' => [
'refund' => 888,
'from' => [[
'account' => 'AVAILABLE',
'amount' => 444,
],],
'total' => 888,
'currency' => 'CNY',
],
'goods_detail' => [[
'merchant_goods_id' => '1217752501201407033233368018',
'wechatpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'unit_price' => 528800,
'refund_amount' => 528800,
'refund_quantity' => 1,
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/refund/domestic/refunds')->post([
'json' => [
'sub_mchid' => '1900000109',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'out_refund_no' => '1217752501201407033233368018',
'reason' => '商品已售完',
'notify_url' => 'https://weixin.qq.com',
'funds_account' => 'AVAILABLE',
'amount' => [
'refund' => 888,
'from' => [[
'account' => 'AVAILABLE',
'amount' => 444,
],],
'total' => 888,
'currency' => 'CNY',
],
'goods_detail' => [[
'merchant_goods_id' => '1217752501201407033233368018',
'wechatpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'unit_price' => 528800,
'refund_amount' => 528800,
'refund_quantity' => 1,
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/refund/domestic/refunds']->post([
'json' => [
'sub_mchid' => '1900000109',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'out_refund_no' => '1217752501201407033233368018',
'reason' => '商品已售完',
'notify_url' => 'https://weixin.qq.com',
'funds_account' => 'AVAILABLE',
'amount' => [
'refund' => 888,
'from' => [[
'account' => 'AVAILABLE',
'amount' => 444,
],],
'total' => 888,
'currency' => 'CNY',
],
'goods_detail' => [[
'merchant_goods_id' => '1217752501201407033233368018',
'wechatpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'unit_price' => 528800,
'refund_amount' => 528800,
'refund_quantity' => 1,
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
refund_id | string | 微信支付退款号 |
out_refund_no | string | 商户退款单号 |
transaction_id | string | 微信支付订单号 |
out_trade_no | string | 商户订单号 |
channel | string | 退款渠道 |
user_received_account | string | 退款入账账户 |
success_time | string | 退款成功时间 |
create_time | string | 退款创建时间 |
status | string | 退款状态 |
funds_account | string | 资金账户 |
amount | object | 金额信息 |
total | integer | 订单金额 |
refund | integer | 退款金额 |
from | object[] | 退款出资账户及金额 |
account | string | 出资账户类型 |
amount | integer | 出资金额 |
payer_total | integer | 用户支付金额 |
payer_refund | integer | 用户退款金额 |
settlement_refund | integer | 应结退款金额 |
settlement_total | integer | 应结订单金额 |
discount_refund | integer | 优惠退款金额 |
currency | string | 退款币种 |
refund_fee | number | 手续费退款金额 |
promotion_detail | object[] | 优惠退款信息 |
promotion_id | string | 券ID |
scope | string | 优惠范围 |
type | string | 优惠类型 |
amount | integer | 优惠券面额 |
refund_amount | integer | 优惠退款金额 |
goods_detail | object[] | 商品列表 |
merchant_goods_id | string | 商户侧商品编码 |
wechatpay_goods_id | string | 微信侧商品编码 |
goods_name | string | 商品名称 |
unit_price | integer | 商品单价 |
refund_amount | integer | 商品退款金额 |
refund_quantity | integer | 商品退货数量 |