前提需要有商户号

'app_id'                 =>'wx0eb1dfa7b1',//公众平台

'app_secret' =>'c1320e145c9ff60eebee5c16',//授权时要

'mch_id' =>'1605922687',//商户号

'key' =>'xiaoxi6zikejiyouxiangongsi289'//密钥


要引入php类文件地址  https://gitee.com/zzl_index/wechat-refund.git


// 接微信支付JsApi 方式

$notify_url = $_SERVER['HTTP_HOST'].'/api/index/notify_url';//回调函数

$data = [
'price' => 0.01,// 支付金额
'openid' => $this->getValue($param['user_id']),//用户的open_id
'order_sn' => $datas['order_no'],//订单号
'body' => '预约支付',//支付标题
'notify_url' => $notify_url,//回调函数
];
$pay = new WxPay();

$res = $pay->payApi($data);//微信支付

if($res){
return 1;//成功
}else{
return 0;//失败
}