gpt4 book ai didi

codeigniter - Paypal JS SDK 结帐 : fetch returns error 500 when switching from sandbox to live

转载 作者:行者123 更新时间:2023-12-05 05:33:22 25 4
gpt4 key购买 nike

PayPal JS SDK 在沙盒模式下运行良好,但在 Live 中我不断收到 500 错误。

我使用 SDK 成功授权信用卡支付,但在 https://www.paypal.com/sdk/js?client-id=xxfunding=credit,card&currency=MYR 中出现错误消息

throw new Error("Promise serialization is not implemented; nothing to deserialize")

我遵循了 PayPal 指南,在这里真的看不出我的错误:

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.'));

}
}

enter image description here

最佳答案

在 PHP 中...

if($gateway_data['dev_mode'] == true)

..确保此配置值设置为false,以便代码与 PayPal 实时/生产端点通信,并将 clientId 和密码更改为来自“My Apps & Credentials 的“实时”选项卡

关于codeigniter - Paypal JS SDK 结帐 : fetch returns error 500 when switching from sandbox to live,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73876368/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com