美文网首页PHP实战PHP经验分享
thinkphp整合系列之微信退款

thinkphp整合系列之微信退款

作者: geeooooz | 来源:发表于2018-03-29 16:39 被阅读30次

微信退款SDK: https://pan.baidu.com/s/1UjWiWN_ELvfsDk0gPWO7Sg

SDK放在

微信退款文档参考:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4

RefundController.class.php
#退款控制器

<?php
/**
 * 退款操作
 */
namespace WxShop\Controller;
use Think\Controller;
class RefundController extends Controller {
    public function index()
    {   
        $transaction_id = '4200000076201803297600309262';//支付时将返回的微信订单号(transaction_id)保存
        $out_refund_no = '1522286077456iA4nadehdI225';//填之前的支付时的订单号就可以了
        $total_fee = '0.01';//订单总金额,单位为分,只能为整数
        $refund_fee = '0.01';//退款总金额,订单总金额,单位为分,只能为整数
        Vendor('WeixinRefund.wxpay#class');//引入退款类
        $wxpay = new \WxPay();
        $result = $wxpay->refund($transaction_id,$out_refund_no,$total_fee,$refund_fee);
        //具体的看返回的$result的参数 然后做后续操作即可
        
    }
    
}

相关文章

网友评论

    本文标题:thinkphp整合系列之微信退款

    本文链接:https://www.haomeiwen.com/subject/gjzmcftx.html