首页 / 话题 / 支付乐 / 文章详情

对接Z支付的源码的公众号接口如何对接支付乐的免公众号接口

一直在的 2022-03-20 | 阅读(4784) | 评论(0

第一步:找到Z支付的SDK文件夹zpay_sdk,依次打开src文件夹,你会看到这三个文件,如图:

1647788518(1)

第二步:将ZPaySdk.php文件里面的域名https://pay.rxkku.net换成支付乐的网关域名:http://pay.ezhan.run ,如图:

换之前、

1647788738(1)

换之后、

1647788833(1)

第三步:将zpay_config.php文件里面的第4行换成你的支付乐商户id,第6行换成你的支付乐商户秘钥

1647789040(1)

第四步:将zpay_function.php文件里面的“发送http请求使用“代码换成下面的代码

1647789268(1)

//发送http请求使用
function get_cur($url,$data, $post = 0, $cookie = 0, $header = 0, $nobaody = 0)
    {
        $url = $url.'?'.http_build_query($data);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_TIMEOUT, 15);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $klsf[] = 'Accept:*/*';
        $klsf[] = 'Accept-Language:zh-cn';
        //$klsf[] = 'Content-Type:application/json';
        $klsf[] = 'User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Mobile/15C153 MicroMessenger/6.6.1 NetType/WIFI Language/zh_CN';
        $klsf[] = 'Referer:'.$url;
        curl_setopt($ch, CURLOPT_HTTPHEADER, $klsf);
        if ($post) {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }
        if ($header) {
            curl_setopt($ch, CURLOPT_HEADER, true);
        }
        if ($cookie) {
            curl_setopt($ch, CURLOPT_COOKIE, $cookie);
        }
        if ($nobaody) {
            curl_setopt($ch, CURLOPT_NOBODY, 1);
        }
        curl_setopt($ch, CURLOPT_TIMEOUT,60);
        curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $ret = curl_exec($ch);
        curl_close($ch);
        return $ret;
    }

换好之后的样子:

1647789402(1)

第五步:去支付乐商户中心免公众号接口里面去授权你的域名

评论(0)
请登录
请登录后发表评论