Laravel

Paypal integration in laravel

Paypal integration in laravel

In this tutorials I am going to explain how to integrate payapl payment gateway in laravel.

Its very simple to integrate paypal in laravel if you are having basic knowledge in paypal integration and laravel.

STEP 1 : Instal paypal SDK thru composer

Edit Composer.json

Update the composer. You can now use the PayPal package in your application.

STEP 2 : Paypal Configuration.  

app/config/paypal.php

Here you can specify your paypal mode is ” sndbox ” or ” live “.



Setup paypal Controller. My page is PaypalController.php

 STEP 3 : Setup Routes => routes.php and Checkout Controller

app/controllers/PaypalController.php

 

Once you press checkout it will execute the above function and pass the item data to paypal. You will see the paypal payment page.
Login and pay the amount.

Once your amount has been paid you will see the screen like please wait it’s automatically redirect or click here, // If you are using chrome its not an issue, if you using firefox your site need HTTPS, If your site in HTTP you need to click ” click here” link else firefox does not return the data’s

If your payment Successful it will return 2 parameters
1. token
2. PayerID

If your payment Cancelled it will return 1 parameters
1. token

STEP : 4

We have specified return URL, So the page redirect to PaypalController.php -> getPaymentStatus() function.

app/controllers/PaypalController.php

 

You have completed. If everything ok ” print_r($result) “ will dispaly your transaction result.

To get client_id and secret please follow below steps,

1. Login to developer paypal,
2. Click Dashboard.
3. Click My Apps in left widget and right side it will list out your app and click your app.
4. Below Add webhook button find Live credentials Show (link).
5. Click Show(link) you can see your client_id and secret.

Get it and use it app/config/paypal.php page.

Check Paypal integration in php here.

Check Paypal Integration in LARAVEL 5.4

Thanks!.

If you like this article don’t forget to share and comment.