SetBody($data['title']); $input->SetOut_trade_no($data['ordersn']); $input->SetTotal_fee($data['fee']*100); $input->SetTime_start(date("YmdHis",$data['create_time'])); $input->SetTime_expire(date("YmdHis", $data['create_time'] + 3600)); $input->SetNotify_url($data['notify_url']); $input->SetTrade_type("JSAPI"); $input->SetOpenid($data['openid']); $config = new \WxPayConfig(); // $config->GetAppId($appid); // $config->GetMerchantId('1612051549'); // $config->GetKey('ggigi4646gsg46d46g48g6d464g8fd74'); // $config->GetAppSecret('$appsecret'); // $config->appid = $appid; // $config->mchid = '1612051549'; // $config->key = 'ggigi4646gsg46d46g48g6d464g8fd74'; // $config->secret = $appsecret; $config->wxid = $wxid; $order = \WxPayApi::unifiedOrder($config, $input); $jsApiParameters = $tools->GetJsApiParameters($order); // dump($jsApiParameters);die; return $jsApiParameters; } }