今天,我第一次在几个客户交易的返回URL上遇到多个ACCOUNT_CANNOT_BE_FETCHED错误。
这是发生错误的特定行
$payment = \PayPal\Api\Payment::get($paymentId, $apiContext);
这是上下文配置中定义的PayPal日志捕获的消息
[12-04-2019 06:14:12] PayPal\Core\PayPalHttpConnection : ERROR: Got Http response code 400 when accessing https://api.paypal.com/v1/payments/payment/PAYID-xxxxxxxxxxxxxxxxxxxxxxxx. {"name":"ACCOUNT_CANNOT_BE_FETCHED","message":"Account can not be fetched.","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"xxxxxxxxxxxxx"}
有关该错误的文档不是很简单。
问题在于,由于交易成功,因此我不知道是退款还是绕过此错误并继续进行其他操作。
正如所建议的,这是一个简短的例外
[url:PayPal\Exception\PayPalConnectionException:private] => https://api.paypal.com/v1/payments/payment/PAYID-xxxxxxxxxxxxxxxxxxxxxxxx
[data:PayPal\Exception\PayPalConnectionException:private] => {"name":"ACCOUNT_CANNOT_BE_FETCHED","message":"Account can not be fetched.","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"xxxxxxxxxxxxx"}
[message:protected] => Got Http response code 400 when accessing https://api.paypal.com/v1/payments/payment/PAYID-xxxxxxxxxxxxxxxxxxxxxxxx.
[string:Exception:private] =>
[code:protected] => 400
[file:protected] => /path/to/library/PayPal/Core/PayPalHttpConnection.php
[line:protected] => 177
有什么主意吗?
谢谢
答案 0 :(得分:0)
try {
$payment = \PayPal\Api\Payment::get($paymentId, $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
var_dump(json_decode($ex->getData()));
exit(1);
}
这还不是答案,但是它的一大堆代码将有助于调试,并有望变成答案。请尝试将其包装在您的代码中,然后发布获得的JSON结果,这将有助于调试问题。