首先,确保在你的 WordPress 中安装了 RiPro-v5 主题。如果没有,请先安装该主题。也可以下载我们发布的集成好的整站资源包。
整站源码包下载:https://addon.zhifux.com/42.html
本文介绍下如何在你已经运营的网站中增加我们的支付方式。
1.文件路径参考如下
wp-content/themes/ripro-v5/inc/options/admin-options.phpwp-content/themes/ripro-v5/inc/template-shop.phpwp-content/themes/ripro-v5/inc/shop/zhifux/notify.phpwp-content/themes/ripro-v5/inc/shop/zhifux/return.phpwp-content/themes/ripro-v5/assets/css/main.min.css
2.具体修改代码
2.1admin-options.php的2250行左右加入如下代码

// zhifux.com 支付FM 开始// 支付FM-支付宝array('id' => 'is_zhifux_alipay','type' => 'switcher','title' => '支付FM(支付宝收款码)','label' => '支付宝免签类型,本API接口为支付FM 免签支付宝收款码收款接口','default' => false,),array('id' => 'zhifux_alipay','type' => 'fieldset','title' => '配置详情','fields' => array(array('type' => 'notice','style' => 'success','content' => '支付FM<a target="_blank" href="https://www.zhifux.com">注册地址</a>',),array('id' => 'pid','type' => 'text','title' => '商户号','desc' => '','default' => '',),array('id' => 'key','type' => 'text','title' => '接入密钥','desc' => '','default' => '','attributes' => array('type' => 'password',),),array('id' => 'apiurl','type' => 'text','title' => 'API接口地址','desc' => '请填写你的支付FM-接口地址,在支付FM后台的用户中心页面查看,本站https如果启用的话,接口地址也要用https的。','default' => '',),),'dependency' => array('is_zhifux_alipay', '==', 'true'),),// 支付FM-微信收款码array('id' => 'is_zhifux_weixin','type' => 'switcher','title' => '支付FM(微信收款码)','label' => '微信免签类型,本API接口为支付FM 免签微信收款码收款接口','default' => false,),array('id' => 'zhifux_weixin','type' => 'fieldset','title' => '配置详情','fields' => array(array('type' => 'notice','style' => 'success','content' => '支付FM <a target="_blank" href="https://www.zhifux.com">注册地址</a>',),array('id' => 'pid','type' => 'text','title' => '商户号','desc' => '','default' => '',),array('id' => 'key','type' => 'text','title' => '接入密钥','desc' => '','default' => '','attributes' => array('type' => 'password',),),array('id' => 'apiurl','type' => 'text','title' => 'API接口地址','desc' => '请填写你的支付FM-接口地址,在支付FM后台的用户中心页面查看,本站https如果启用的话,接口地址也要用https的。','default' => '',),),'dependency' => array('is_zhifux_weixin', '==', 'true'),),array('id' => 'is_zhifux_alipay_pc_all','type' => 'switcher','title' => '支付FM(支付宝签约)','label' => '支付宝签约类型集成通道,个人也可以开商户,接口支持官方支付宝、富友、杉德等通道轮训+商户号混合轮训','default' => false,),array('id' => 'zhifux_alipay_pc_all','type' => 'fieldset','title' => '配置详情','fields' => array(array('type' => 'notice','style' => 'success','content' => '支付FM<a target="_blank" href="https://www.zhifux.com">注册地址</a>',),array('id' => 'pid','type' => 'text','title' => '商户号','desc' => '','default' => '',),array('id' => 'key','type' => 'text','title' => '接入密钥','desc' => '','default' => '','attributes' => array('type' => 'password',),),array('id' => 'apiurl','type' => 'text','title' => 'API接口地址','desc' => '请填写你的支付FM-接口地址,在支付FM后台的用户中心页面查看,本站https如果启用的话,接口地址也要用https的。','default' => '',),),'dependency' => array('is_zhifux_alipay_pc_all', '==', 'true'),),// 支付FM-微信签约全部array('id' => 'is_zhifux_wechat_pc_all','type' => 'switcher','title' => '支付FM(微信签约)','label' => '微信签约类型集成通道,个人也可以开商户,接口支持官方支付宝、富友、杉德等通道轮训+商户号混合轮训','default' => false,),array('id' => 'zhifux_wechat_pc_all','type' => 'fieldset','title' => '配置详情','fields' => array(array('type' => 'notice','style' => 'success','content' => '支付FM <a target="_blank" href="https://www.zhifux.com">注册地址</a>',),array('id' => 'pid','type' => 'text','title' => '商户号','desc' => '','default' => '',),array('id' => 'key','type' => 'text','title' => '接入密钥','desc' => '','default' => '','attributes' => array('type' => 'password',),),array('id' => 'apiurl','type' => 'text','title' => 'API接口地址','desc' => '请填写你的支付FM-接口地址,在支付FM后台的用户中心页面查看,本站https如果启用的话,接口地址也要用https的。','default' => '',),),'dependency' => array('is_zhifux_wechat_pc_all', '==', 'true'),),//zhifux.com 支付FM结束
2.2template-shop.php 1124行左右,1349行左右增加支付FM相关代码如下

101 => ['id' => 'zhifux_alipay', 'name' => '支付宝', 'is' => (bool) _cao('is_zhifux_alipay')],102 => ['id' => 'zhifux_weixin', 'name' => '微信', 'is' => (bool) _cao('is_zhifux_weixin')],111 => ['id' => 'zhifux_alipay_pc_all', 'name' => '支付宝', 'is' => (bool) _cao('is_zhifux_alipay_pc_all')],112 => ['id' => 'zhifux_wechat_pc_all', 'name' => '微信', 'is' => (bool) _cao('is_zhifux_wechat_pc_all')],

$alipay_group = [1, 11, 21, 31, 41,101,111];$weixinpay_group = [2, 12, 22, 32, 42,102,112];

case 'zhifux_alipay':case 'zhifux_weixin':case 'zhifux_alipay_pc_all':case 'zhifux_wechat_pc_all':#支付FM$the_pay_type = $pay_optons['id'];$type = $the_pay_type;$zhifuxconfig = _cao('zhifux_alipay');if($the_pay_type== "zhifux_alipay"){$zhifuxconfig = _cao('zhifux_alipay');$type = "alipay";}else if($the_pay_type== "zhifux_weixin"){$zhifuxconfig = _cao('zhifux_weixin');$type = "wechat";}else if($the_pay_type== "zhifux_alipay_pc_all"){$zhifuxconfig = _cao('zhifux_alipay_pc_all');$type = "alipay-pc-all";}else if($the_pay_type== "zhifux_wechat_pc_all"){$zhifuxconfig = _cao('zhifux_wechat_pc_all');$type = "wechat-pc-all";}//商户参数$returnType = "json";$api_url = $zhifuxconfig['apiurl'];; //在用户中心页面查看 接口地址$merchantNum = $zhifuxconfig['pid'];$secret = $zhifuxconfig['key'];$notifyUrl = home_url('/') . 'pay/callback/zhifux/notify/';$sign = md5($merchantNum.$order_data['order_trade_no'].$order_data['order_price']. $notifyUrl.$secret);$native = array("merchantNum" => $merchantNum,"payType" => $type,"amount" => $order_data['order_price'],//金额,"orderNo" => $order_data['order_trade_no'],"subject"=> $order_data['order_name'],"notifyUrl" => $notifyUrl,"returnUrl" => home_url('/') . 'pay/callback/zhifux/return/',"sign" => $sign,"returnType" =>$returnType);$param = http_build_query($native);$return = http_request_fm($api_url, $param, 'application/x-www-form-urlencoded;charset=utf-8');if(strpos($return,'{') === 0){$resultData = json_decode($return,true);if($resultData['success']){$data = $resultData['data']['payUrl'];//方式1 弹窗$pay_url = $data;$pay_url = zb_get_pay_body_html($order_data['pay_type'], $order_data['pay_price'], get_qrcode_url($pay_url));// 方式2 跳转//if (!empty($data)) {// $result['method'] = 'url';// $pay_url = $data;// }}else{echo json_encode(array('status' => '0', 'msg' => $resultData['msg']));exit;}}else{echo json_encode(array('status' => '0', 'msg' => $return));exit;}break;
2.3创建目录zhifux,上传附件里面的文件notify.php和return.php
下载链接:https://share.weiyun.com/oXRwavYv 密码:ha8fbs
2.4 main.min.css增加样式代码
搜索alipay-i.png,在如下图位置处增加样式代码

图中红线部分对应的css代码,注意签名的逗号别漏了,.pay-select-box .pay-item>i.zhifux_alipay_pc_all,.pay-select-box .pay-item>i.zhifux_alipay图中绿线部分对应的css代码,.pay-select-box .pay-item>i.zhifux_weixin,.pay-select-box .pay-item>i.zhifux_wechat_pc_all
