payment = $factory->payment(config('wechat.mini_pay',[])); } /** * 微信小程序支付下单 * */ public function unifiedOrder($request) { $result = $this->payment->order->unify($request); if ($result['return_code'] === 'SUCCESS' && !isset($result['err_code'])) { $prepayId = $result['prepay_id']; $json = $this->payment->jssdk->sdkConfig($prepayId); return response()->json($json); } else { return response()->json(['error' => '创建订单失败'], 500); } } }