4
當我執行PayPal的sample/billing/CreatePlan.php時,我收到一個錯誤REQUIRED_SCOPE_MISSING ,我的clientId和密碼是 。它工作正常使用 提供的clientId和祕密。貝寶休息API,PHP SDK,計費,我得到錯誤REQUIRED_SCOPE_MISSING
復現:
下載貝寶PHP-SDK v0.14.2
去
運行
PHP CreatePlan.php
9此文件線包括採樣/計費bootstrap.php程序。這是定義了clientId和secret的 。
如果我使用現有的clientId和祕密 它會正常工作。如果我替換我的 自己的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和祕密工作細跟所有 支付樣品。
順便說一句,只是讓你知道,如果你正在使用PHP5.4或更高版本,現在可以得到的樣本工作通過使用內置的PHP服務器通過運行一個網頁命令: php -f samples/index.php 只要確保您使用的是最新代碼。爲此,即將發佈。 – 2014-11-21 22:43:19