切换PayPal从沙箱到生产环境时JS SDK Checkout报500及序列化错误
PayPal JS SDK生产环境500错误排查求助
沙箱模式下PayPal JS SDK运行正常,但切换至生产环境后持续出现500错误。目前已能通过该SDK成功授权信用卡支付,但加载链接https://www.paypal.com/sdk/js?client-id=xx&funding=credit,card¤cy=MYR时抛出以下错误:
throw new Error("Promise serialization is not implemented; nothing to deserialize")
已严格按照PayPal官方指南完成配置,但无法定位问题根源。后端捕获订单的PHP代码如下:
public function paypal_capture() { $gateway_data = $this->billing->gateway(4); $orderId = $this->input->post('orderID', true); $itype = $this->input->post('itype', true); $clientId =$gateway_data['key1']; //$paypal_conf['client_id']; $clientSecret =$gateway_data['key2'];//$paypal_conf['secret']; if($gateway_data['dev_mode'] == true) { $environment = new \PayPalCheckoutSdk\Core\SandboxEnvironment($clientId, $clientSecret); } else { $environment = new \PayPalCheckoutSdk\Core\ProductionEnvironment($clientId, $clientSecret); } $client = new \PayPalCheckoutSdk\Core\PayPalHttpClient($environment); $request = new \PayPalCheckoutSdk\Orders\OrdersCaptureRequest($orderId); $request->prefer('return=representation'); try { $response = $client->execute($request); echo json_encode($response); $response = json_decode(json_encode($response), true); if (isset($response['result']) and $response['result']['intent'] == 'CAPTURE' and $response['result']['status'] == 'COMPLETED') { $note = 'INV '.$response['result']['purchase_units'][0]['reference_id'].' Paypal Payment #' . $response['result']['id']; $this->billing->paynow($response['result']['purchase_units'][0]['reference_id'], $response['result']['purchase_units'][0]['amount']['value'], $note, 'Card',$itype); } } catch (HttpException $ex) { echo json_encode(array('status'=>'Error','message'=>'Code '.$ex->statusCode.' Contact to seller.')); } }

请求协助排查该问题的原因。
内容的提问来源于stack exchange,提问作者Adam Harris bin Suppuramany
相关产品推荐
相关产品推荐

