回傳引數:
"error":"invalid_client","error_description":"The client credentials are invalid"}"
模式
貝寶支付分為兩種模式:
沙盒模式(sandbox)和正式(live),出現401問題基本就是賬戶和模式不匹配問題,代碼內設定模式如下:
$this->PayPal->setConfig(
array(
'mode' => 'sandbox',
'log.LogEnabled' => true,
'log.FileName' => '../PayPal.log',
'log.LogLevel' => 'DEBUG', // PLEASE USE `INFO` LEVEL FOR LOGGING IN LIVE ENVIRONMENTS
'cache.enabled' => true
)
);
$this->PayPal->setConfig(
array(
'mode' => 'live',
'log.LogEnabled' => true,
'log.FileName' => '../PayPal.log',
'log.LogLevel' => 'FINE', // PLEASE USE FINE LEVEL FOR LOGGING IN LIVE ENVIRONMENTS
'cache.enabled' => true,
// 'http.CURLOPT_CONNECTTIMEOUT' => 30
// 'http.headers.PayPal-Partner-Attribution-Id' => '123123123'
)
);
命令查詢
通過命令列直接先測驗下賬號問題:
curl -v -u "AV-SNw2j-1wNqAb1ygg0I4iKT8E8zHT1QCh8eLEbeFZQN2slHhq4dX5pKn4mfz7CHGDhCaVX1NhShB0G:EHjumNJEwf5lkurMyNqo1DJ1v64jsZ9mpFYlKIkVQBh6Kksygxx_u77F8G0rSQHW9Awezdqd4RCdGmVM" "https://api.sandbox.paypal.com/v1/oauth2/token" -X POST -d "response_type=token&grant_type=client_credentials"
curl -v -u "client_id:secret" "https://api.sandbox.paypal.com/v1/oauth2/token" -X POST -d "response_type=token&grant_type=client_credentials"
-u 用戶名:密碼登錄
-v, --verbose Make the operation more talkative
-d data
成功回傳:
{
"scope": "https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller https://uri.paypal.com/services/payments/refund https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks",
"access_token": "A21AALPwFtDpb5jpWRVv_VvX3aiGGGRQag6qJUOT6tLfPpalV2pTkGY4I_KUbJjuxNCg1XA7XyiFinMBZuYMEYhDbfxgcQrwg",
"token_type": "Bearer",
"app_id": "APP-80W284485P519543I",
"expires_in": 31035,
"nonce": "2020-12-11T03:23:27ZQMW1i1Gnu2BtxvJ5V_EJBwN1dRMeFd3Ujp61jYMODlY"
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/233920.html
標籤:區塊鏈
下一篇:標準Go專案布局
