我在前端(javascript)創(chuàng)建貝寶訂單并獲取 orderId 和 payerId:createOrder: async (data, actions) => { const item = await this.fetchPaypalItem() return actions.order.create({ purchase_units: [ { description: item.description, amount: { value: item.description, } } ] }) },我收到了我檢查過的 orderId 和 payerId。在服務(wù)器端(Laravel),我正在使用官方庫https://github.com/paypal/Checkout-PHP-SDK,當我嘗試創(chuàng)建訂單(來自 paypal 文檔)時,出現(xiàn)錯誤,如下所示:public function createOrder(Request $request){ $request = new OrdersCreateRequest(); $request->prefer('return=representation'); $request->body = self::buildRequestBody(); // 3. Call PayPal to set up a transaction $client = PayPalClient::client(); $response = $client->execute($request); return response()->json($response);}我檢查了一下,$client 對象是空對象。我正在檢查我的憑據(jù),但沒有問題,因為它正在 javascript 上運行。我更改了該官方庫的 HttpClient 類中的一行: $curl->setOpt(CURLOPT_SSL_VERIFYPEER, true); => $curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); 現(xiàn)在它正在工作,但我擔心它不安全。有什么解決方案可以解決這個問題嗎?這樣安全嗎?
Paypal 結(jié)帳錯誤:“SSL 證書問題:無法獲取本地頒發(fā)者證書”
ibeautiful
2023-07-07 10:43:52