【发布时间】:2019-06-27 22:14:15
【问题描述】:
试图让我的 paypal REST api 网站上线。它在沙盒模式下运行良好,传输经过验证。
当我为实时客户端 ID 和密码切换沙箱时,我收到错误
{"error":"invalid_client","error_description":"Client Authentication failed"}
我检查并确保我的代码应该上线
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
PP_CLIENT_ID , // ClientID
PP_CLIENT_SECRET // ClientSecret
)
);
// setting mode to live
// https://github.com/paypal/PayPal-PHP-SDK/wiki/Going-Live
$apiContext->setConfig([
'mode' => 'live',
]);
通过 wp_ajax 运行它
任何帮助将不胜感激!谢谢!
2/5/2019:似乎其他人也遇到了这个问题:https://github.com/paypal/PayPal-PHP-SDK/issues/435
我错过了关于 StackOverflow 的同一个问题……也没有答案。 PayPal App works perfectly as Sandbox, Client Authentication failed on Live: list of steps to check?
【问题讨论】:
-
双重和三重检查客户端 ID 和秘密,因为这似乎是 API 抱怨的内容。
-
感谢@MagnusEriksson,我从现场网站一遍又一遍地复制和粘贴,只是为了确保我没有错过字符串中的任何字符。
-
不熟悉 paypal API 但可能端点 URL 在两种情况下都不同?从看起来不像的代码来看,但这个 API 需要设置端点 URL 吗?
-
感谢@ron 的回复,这绝对是一个好点。但是我使用的是他们的 Paypal SDK,所以我认为应该正确设置端点。
标签: php paypal paypal-rest-sdk