$order->id, 'type' => $type, 'amount' => $order->price, ]); return $payOrder; } public function order(Request $request, $orderid) { $order = CardOrder::where('order_id', $orderid)->first(); return view('Agent::pay.order', compact('order')); } /** * 微信支付 * @param Request $request [description] * @param [type] $orderid [description] * @return [type] [description] */ public function wechat(Request $request, $orderid) { $order = CardOrder::where('order_id', $orderid)->first(); $openid = $order->user->openid; $amount = $order->price; $payOrder = $this->getpayOrder($order, 'WECHAT'); if ($amount != $payOrder->amount) { $payOrder->amount = $amount; $payOrder->save(); } $app = app('wechat.payment'); $amount = $payOrder->amount; $result = $app->order->unify([ 'body' => '商城订单-进货卡', 'out_trade_no' => $payOrder->trade_no, // 'total_fee' => $amount * 100, 'total_fee' => 1, 'notify_url' => route('Agent.notify.payment'), 'trade_type' => 'JSAPI', 'openid' => $openid, ]); if ($result['return_code'] == 'SUCCESS' && isset($result['prepay_id'])) { $json = $app->jssdk->bridgeConfig($result['prepay_id']); return $this->success($json); } else { return $this->error($result['return_msg']); } } }