dtvam48220 2014-11-16 16:42
浏览 68
已采纳

Paypal API将访问令牌返回为Null

I have installed the Paypal PHP SDK and am having trouble getting a access token in Sandbox mode.

$sdkConfig = array(
    "mode" => "sandbox"
);

// new OAuthTokenCredential(ClientID, Secret, sdkConfig)
$cred =  new OAuthTokenCredential("$clientID","$secret", $sdkConfig);

The $cred, when returned, only has the client, secret and logging manager populated, everything else is null.

When stepping through the OAuthTokenCredential class it only runs through as far as the initial function. None of the accesstoken functions run.

I'm assuming that the SDK is okay as other people are presumably using it, so I'm guessing that there is a fairly simple solution.

  • 写回答

1条回答 默认 最新

  • dongyu5482 2014-11-18 12:04
    关注

    It isn't documented anywhere, but I've found that adding this directly after the above code works perfectly.

    $cred->accessToken = $cred->getAccessToken($sdkConfig);
    

    Not sure why it isn't documented, but this now works for me.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿