public function Queryorder($transaction_id)
 {
     $input = new WxPayOrderQuery();
     $input->SetTransaction_id($transaction_id);
     $result = WxPayApi::orderQuery($input);
     if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * 根据订单信息生成签名
  * @param $data 订单信息
  * @return Weixin\json数据|null
  * @throws Weixin\WxPayException
  */
 public function jspay($data)
 {
     $jsApiParameters = null;
     if ($data) {
         $tools = new JsApiPay();
         $openId = session('openId');
         $input = new WxPayUnifiedOrder();
         $input->SetBody($data['body']);
         $input->SetAttach($data['attach']);
         $input->SetTotal_fee(intval($data['total_fee']));
         $input->SetGoods_tag($data['goods_tag']);
         $input->SetNotify_url($data['notify_url']);
         $input->SetOut_trade_no($data['order_id']);
         $input->SetTime_start($data['time']);
         $input->SetTime_expire(date("YmdHis", time() + 600));
         $input->SetTrade_type("JSAPI");
         $input->SetOpenid($openId);
         $order = WxPayApi::unifiedOrder($input);
         $jsApiParameters = $tools->GetJsApiParameters($order);
     }
     return $jsApiParameters;
 }