Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kris01's avatar

PayPal Integration

Hello,

I am trying to add a 'Connect With PayPal' button on my web app, in order to be able to get all the paypal trasaction of a certain user, however I am having a bit of a problem.

In order to login with paypal we must to an api post call to an endpoint to receive an access token, which we will use to make other api calls.

The problem is that this first api call is asking for an authorization code but I am unable to find it.

If someone can please help, I will leave a link to the page https://developer.paypal.com/docs/log-in-with-paypal/integrate/#get-access-token

0 likes
3 replies
thinkverse's avatar

Instead of implementing an OAuth provider yourself, I'd recommend going with Laravel Socialite, they'll handle all the API calls for you, all you have to do is use the Socialite facade with a supported OAuth provider, or driver as they call it and Socialite Providers has a PayPal driver for Socialite.

composer require socialiteproviders/paypal
Kris01's avatar

@thinkverse The problem is that with Socialite I can only get users information. After the login I will need adittional information like transactions, income and so on

thinkverse's avatar
Level 15

@Kris01 You can grab the user token to use in further API calls as well with Socialite, from both OAuth 1.0 and OAuth 2.0 providers. The documentation on retrieving user details shows you how.

$user = Socialite::driver('paypal')->user();

$token = $user->token;
$refreshToken = $user->refreshToken;
$expiresIn = $user->expiresIn;

Please or to participate in this conversation.