Hi. I'm trying to call the https://api.sandbox.paypal.com/v1/oauth2/token to simply have a token. I'm using php curl.
Here is my code :
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.sandbox.paypal.com/v1/oauth2/token", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_USERPWD => $PAYPAL_CLIENT_ID.":".$PAYPAL_SECRET,
CURLOPT_POSTFIELDS => "{\"grant_type\":\"client_credentials\"}",
CURLOPT_HTTPHEADER => array( "Accept: application/json", "Accept-Language: en_US" ), ));
The answer is : {"error":"unsupported_grant_type","error_description":"Grant Type is NULL"} I checked and I simply use the grant type i've found here : https://developer.paypal.com/docs/api/get-an-access-token-curl/
I'm totally lost with the error, because it's the very beginning of my integration. Thank you.
... View more