我正在使用 PHP PayPal REST API 沙箱并在执行我的操作时出现错误$payment->create( $apiContext );
我的错误日志显示为:
PHP Fatal error: Uncaught exception 'PayPal\\Exception\\PPConnectionException' with message
'Got Http response code 401 when accessing https://api.paypal.com/v1/oauth2/token.
Retried 0 times.' in /usr/local/web/servers/domain/guts/paypal_api/vendor/paypal/sdk-core-php/lib/PayPal/Core/PPHttpConnection.php:99\nStack trace:\n
#0 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/Auth/OAuthTokenCredential.php(96):
PayPal\\Core\\PPHttpConnection->execute('grant_type=clie...')\n
#1 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/Auth/OAuthTokenCredential.php(76):
PayPal\\Auth\\OAuthTokenCredential->_generateAccessToken(Array)\n
#2 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/Rest/RestHandler.php(56): PayPal\\Auth\\OAuthTokenCredential->getAccessToken(Array)\n
#3 /usr/local/web/servers/domain/guts/paypal_api/vendor/paypal/sdk-core-php/lib/PayPal/Transport/PPRestCall.php(41):
PayPal\\Rest\\RestHandler->handle(Object(PayPal\\Core\\PPHttpConfig), '{"intent":"sale...', Array)\n
#4 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/A in
/usr/local/web/servers/domain/guts/paypal_api/vendor/paypal/sdk-core-php/lib/PayPal/Core/PPHttpConnection.php on line 99,
referer: http://domain.com/products/basket/verify/
我的 PayPal.log 文件显示:
PayPal\Core\PPHttpConnection: Connecting to https://api.paypal.com/v1/oauth2/token
PayPal\Core\PPHttpConnection: Payload grant_type=client_credentials
PayPal\Core\PPHttpConnection: Adding header User-Agent: PayPalSDK/rest-sdk-php 0.6.0 (lang=PHP;v=5.3.3;bit=64;os=Linux_2.6.18-348.6.1.el5;machine=x86_64;openssl=0.9.8e-fips-rhel5;curl=7.15.5)
PayPal\Core\PPHttpConnection: Adding header Authorization: Basic QVpteVVCQ3VfdDhlb3QxcGx0UksyUG56Y3NhcXpOeXNIMlNDLXBDbTlUNGVGNDE3OFd1cFBFRmhkTVpnOkVGZ3g4UkNCZUppSkw3NW1JV1FDRFROTVVsanFOLW1fdlFuM3owMzZOZ3EwTUp3RVFwRkNlV0Z0dWhaag==
PayPal\Core\PPHttpConnection: Adding header Accept: */*
我试过测试抄送号码,在贝宝的沙箱网站上设置抄送号码。我尝试使用 rest-api-skd-php-master 中提供的演示应用程序中的凭据(演示工作顺便说一句)。
我可以向您展示我的代码,尽管它非常精确地模拟了测试用例。
我唯一能想到的是处理文件被埋在 www 访问级别以下?
如果您可以清除错误日志中的任何信息,我会全力以赴。如果您需要我提供更多信息,我可以提供。