【问题标题】:PayPal REST API - go to live mode with PHP and curlPayPal REST API - 使用 PHP 和 curl 进入实时模式
【发布时间】:2018-05-10 16:30:40
【问题描述】:

我正在开发一个使用 Paypal REST API 进行支付的在线商店。 在沙盒模式下一切正常,但当我尝试上线时,我收到了这条消息:

{"error":"invalid_client","error_description":"Client Authentication failed"}

我将身份验证 URL 更改为:https://api.paypal.com/v1/oauth2/token 我也将客户端 ID 和机密 ID 更改为实时 ID。

在仪表板中还有其他操作可以将我的帐户设置为实时模式吗?

我在我的代码中使用 curl。

    protected $mode = 'PROD'; 

    function getNewToken()
    {
        $url = "https://api.sandbox.paypal.com/v1/oauth2/token"; 

        if ($this->mode == 'PROD')
            $url = "https://api.paypal.com/v1/oauth2/token";

        $token = new ModelAPIToken();
        $token->set('app', 'test-paypal');

        if ($this->mode == 'PROD')
            $token->set('app', 'prod-paypal');

        $token->select();

        $data = 'grant_type=client_credentials'; 

        $curlManager = new Curl();
        $curlManager->setUrl($url); 
        $curlManager->addToHttpHeader('Accept-Language: en_US');
        $curlManager->setCurlOpt(CURLOPT_USERPWD, $token->get('user_key') . ":" . $token->get('user_secret')); 
        $curlManager->execute($data); 
        $response = $curlManager->getResponse();

        preg_match('#"access_token":"(.*)","token_type"#', $response, $match);
        $access_token = $match[1];
        $token->set('access_token', $access_token);
        $token->save();
    }

【问题讨论】:

  • 您是否在开发者仪表板/您的应用上启用了实时环境?登录您的开发者帐户并点击“我的应用和凭据”,然后点击“实时”按钮。
  • 有“直播”按钮,但无法点击。我试过 Safari 和 Chrome。
  • 联系您的贝宝支持。我认为您的帐户尚未激活!!
  • 我是几个小时前做的。暂时没有答案。

标签: php api curl paypal paypal-sandbox


【解决方案1】:

Rest API 不适用于实时模式,即使您在仪表板上看到它们也是如此。即使您在单击 LIVE 按钮时单击帐户资格链接,您也根本无法申请。 REST API 已被提取以供公众使用。应该有联系申请资格的参考;如果没有,请向商家技术支持团队提交工单并索取 REST API paypal-techsupport.com

【讨论】:

猜你喜欢
  • 2014-07-29
  • 2013-03-05
  • 2017-01-23
  • 2020-12-24
  • 2013-03-21
  • 2013-04-25
  • 2013-07-24
  • 2017-07-24
  • 1970-01-01
相关资源
最近更新 更多