即使交易正常,今天也出现多个 ACCOUNT_CANNOT_BE_FETCHED 错误
Posted
技术标签:
【中文标题】即使交易正常,今天也出现多个 ACCOUNT_CANNOT_BE_FETCHED 错误【英文标题】:Today got multiple ACCOUNT_CANNOT_BE_FETCHED error even if transaction is ok 【发布时间】:2019-09-03 10:09:42 【问题描述】:今天我第一次在多个客户交易的返回 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
有什么想法吗?
谢谢
【问题讨论】:
【参考方案1】: try
$payment = \PayPal\Api\Payment::get($paymentId, $apiContext);
catch (PayPal\Exception\PPConnectionException $ex)
var_dump(json_decode($ex->getData()));
exit(1);
这还不是一个答案,但它的一大段代码将有助于调试它并有望变成一个答案。请尝试将其包装在您的代码周围并发布您获得的 JSON 结果,它应该有助于调试问题。
【讨论】:
我将答案与异常的简短描述相结合。谢谢!以上是关于即使交易正常,今天也出现多个 ACCOUNT_CANNOT_BE_FETCHED 错误的主要内容,如果未能解决你的问题,请参考以下文章
即使交易通过,Metamask 也不会显示确认提示的原因可能是啥?
为啥即使在 Plaid 的生产中我也只能取回 100 笔交易
即使设置位置元素和 z-index,Z-index 也无法正常工作?