【发布时间】:2015-01-18 22:14:20
【问题描述】:
我收到错误 REQUIRED_SCOPE_MISSING 执行 PayPal 的 sample/billing/CreatePlan.php 时 我自己的 clientId 和秘密。使用效果很好 提供的 clientId 和 secret。
转载:
下载 PayPal-PHP-SDK v0.14.2
去样品/计费
运行
php CreatePlan.php
此文件的第 9 行包括 bootstrap.php 程序。这是 其中定义了 clientId 和 secret。
如果我使用现有的 clientId 和 secret 它会正常工作。如果我替换我的 拥有自己的 clientId 和秘密,它会给 此处显示的错误消息。
[myprompt]$ php CreatePlan.php
Warning: This sample may require a server to handle return URL. Cannot execute in command line. Defaulting URL to http://localhost/sample/billing
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(1) CREATED PLAN
-------------------------------------------------------------
-------------------------------------------------------------
REQUEST:
{"name":"T-Shirt of the Month Club Plan","description":"Template creation.","type":"fixed",
"payment_definitions":[{"name":"Regular Payments","type":"REGULAR","frequency":"Month",
"frequency_interval":"2","cycles":"12","amount":{"value":"100.00","currency":"USD"},
"charge_models":[{"type":"SHIPPING","amount":{"value":"10.00","currency":"USD"}}]}],
"merchant_preferences":{"return_url":"http://localhost/sample/billing /ExecuteAgreement.php?success=true",
"cancel_url":"http://localhost/sample/billing/ExecuteAgreement.php?success=false","auto_bill_amount":"yes","initial_fail_amount_action": "CONTINUE","max_fail_attempts":"0","setup_fee":{"value":"1.00","currency":"USD"}}}
RESPONSE:
ERROR:Got Http response code 403 when
accessing https://api.sandbox.paypal.com/v1/payments/billing-plans/. {"name":"REQUIRED_SCOPE_MISSING",
"message":"Access token does not have required scope",
"information_link":"https://developer.paypal.com/webapps/developer/docs/api /#REQUIRED_SCOPE_MISSING","debug_id":"261257fb27891"}
-------------------------------------------------------------
我自己的 clientId 和 secret 可以正常工作 付款样本。
【问题讨论】:
-
顺便说一句,如果您使用的是 PHP5.4 或更高版本,您现在只需运行一个命令即可使用内置服务器的 PHP 获取在 Web 上运行的示例:php -f samples/ index.php 只要确保您使用的是最新的代码。很快就会发布。