在根据访问代码获取访问令牌期间,我面临来自 PayPal 的 400 个错误请求响应。我通过以下参考链接https://developer.paypal.com/docs/connect-with-paypal/integrate/#1-create-the-app
我完美地遵循了 5 个步骤,但在第 1 步中遇到了问题。6. 看下面我的代码:
请求部分:
$curl = curl_init();
$base_token = "{client_id:secret}";
$data = array(
CURLOPT_URL => "https://api.sandbox.paypal.com/v1/oauth2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
'grant_type' => 'authorization_code',
'code' => '{authorization_code}'
),
CURLOPT_HTTPHEADER => array(
"Authorization: Basic ".$base_token,
),
);
curl_setopt_array($curl,$data );
$response = curl_exec($curl);
curl_close($curl);
响应部分:
stdClass Object (
[name] => Bad Request
[debug_id] => 5837077aa8787
[message] => java.lang.IllegalArgumentException
[details] => Array
(
)
)
富国沪深
一只萌萌小番薯