Paypal GetUserinfo only returning user_id

gauravpop
Contributor
Contributor

I am using PHP to get user information from pay pal identity API, but unfortunately i only get user_id in response. I need email and payer_id in response. I have read the documentation , according to that i am supposed to receive multiple parameters in response,  but i am receiving only user_id. I have enabled all the scopes in API permissions. here is the documentation https://developer.paypal.com/docs/api/identity/#openidconnect_userinfo.

Here is my code:-- 

$api_url = 'https://api.sandbox.paypal.com/v1/oauth2/token/userinfo?schema=openid';//sandbox

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '. $access_token, 'Content-Type: application/json'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$data = json_decode(curl_exec($ch), true);
//dd($data);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($http_code == 200)
return $data;
else if($http_code == 404)
return false;
else
return false;

 

 

My response 

array:1 [  "user_id" => "https://www.paypal.com/webapps/auth/identity/user/HdoaS1nMgR_Ltt5mBTv4mRvC9P1wUrWt2NlOVH2e_3w"]

 

Login to Me Too
1 REPLY 1

MTS_Andre
Moderator
Moderator

Hi, in some cases you first need to check your account with Customer Service to see if  the account is fine. I recommend to log-in int your PayPal account and then click on this link to get in touch to Customer Service and see if the account is fine.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.