接上文提到的微信支付为前提做的微信退款
服务商模式下的退款,对应api接口是:https://api.mch.weixin.qq.com/v3/refund/domestic/refunds
可看文档:https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_5_9.shtml
废话不多说,上代码:
function wxRefunds($param){
$url = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds";
$url_parts = parse_url($url);
$canonical_url = ($url_parts['path'] . (!empty($url_parts['query']) ? "?${url_parts['query']}" : ""));
$timeStamp = time();
$noncestr = nonce_str();
// var_dump($param);
$params['sub_mchid']=$param['mch_id'];//子商户的商户号---商品对应的门店
$params['transaction_id'] = $param['transaction_id'];//支付回调时候获取到的
$params['out_refund_no'] = $param['refund_order_sn'];//自定义
// $params['notify_url'] = $param['notify_url'];
$params['amo