【问题标题】:PHP SDK for PayPal RESTful APIs going live error用于 PayPal RESTful API 的 PHP SDK 上线错误
【发布时间】:2016-08-10 07:05:38
【问题描述】:

我目前正在尝试从沙盒模式切换到我创建的支付系统。这是我第一次使用 paypal sdk,所以我对它不是很熟悉。一旦我到达应该将您重定向到贝宝的系统点,我就会不断收到以下错误。我知道在我查看所有这些之前已经问过这个问题,尝试了他们的更改,但它仍然对我不起作用。

Error when trying to get to paypal

当它在沙盒模式下完美运行时,我将凭据更改为实时凭据。

这是我系统的开始,它应该授权系统

require __DIR__  . '/vendor/autoload.php';
define('SITE_URL', 'url name');
$paypal = new \PayPal\Rest\ApiContext(
 new \PayPal\Auth\OAuthTokenCredential(
 'Client ID',
 'Secret Code'
 )

);

这是我的 sdk_config.ini 文件,它位于我的代码所在的同一文件夹中:

;Account credentials from developer portal
[Account]
acct1.ClientId = 
acct1.ClientSecret =
;acct2.ClientId = TestClientId
;acct2.ClientSecret = TestClientSecret

;Connection Information
[Http]
http.ConnectionTimeOut = 60
http.Retry = 1
;http.Proxy=http://[username:password]@hostname[:port][/path]

mode=live

;Service Configuration
[Service]
;service.EndPoint="https://api.sandbox.paypal.com"
; Uncomment this line for integrating with the live endpoint 
 service.EndPoint="https://api.paypal.com"


;Logging Information
[Log]
log.LogEnabled=true

; When using a relative path, the log file is created
; relative to the .php file that is the entry point
; for this request. You can also provide an absolute
; path here
log.FileName=PayPal.log

; Logging level can be one of FINE, INFO, WARN or ERROR
; Logging is most verbose in the 'FINE' level and
; decreases as you proceed towards ERROR
log.LogLevel=FINE

;Validation Configuration
[validation]
; If validation is set to strict, the PayPalModel would make sure that
; there are proper accessors (Getters and Setters) for each model
; objects. Accepted value is
; 'log'     : logs the error message to logger only (default)
; 'strict'  : throws a php notice message
; 'disable' : disable the validation
validation.level=strict

我不确定遗漏了什么,请有人指出正确的方向来解决这个问题。此外,在贝宝的开发人员站点中,在您单击实时按钮的实际应用程序下,我单击实时按钮,我的代码使用这些凭据。当它显示实时时,我单击保存,但是当我返回时,它会返回到沙盒。 如果您需要提供额外的代码来找到错误的根源,请告诉我。

【问题讨论】:

    标签: php api rest paypal sdk


    【解决方案1】:

    根据错误消息“invalid_client”,您似乎仍然使用了错误的客户端 ID 和密码,或者可能在沙盒环境中使用了实时凭据。正如您所提到的,在沙盒环境中,它工作正常,因此您的代码没有问题。 如果您正确复制了 live 客户端 id 和 secret,请仔细检查您的代码,可能其他文件中有设置需要配置为 live 环境。

    【讨论】:

      猜你喜欢
      • 2021-07-05
      • 2013-09-23
      • 2017-03-09
      • 2015-01-18
      • 2021-11-24
      • 2013-07-09
      • 2017-04-01
      • 2013-09-10
      • 2016-01-19
      相关资源
      最近更新 更多