Laravel 9 Tutorial

Опубликовано: 25 Июль 2026
на канале: Stack Developers
1,681
14

►Laravel 9 Tutorial from the beginning:-    • Laravel Multi Vendor Tutorial  

In Part-158, we will start working on integrating Paypal Payment Gateway in Laravel 9. We are going to integrate Paypal into our Laravel E-commerce website and will create a business account in Paypal for Sandbox Testing.

Steps to integrate Paypal in Laravel 9 E-commerce website are as below:-

1) Create PaypalController :-
We will create a separate PaypalController by running the below artisan command:-
php artisan make:controller PaypalController

2) Update checkout.blade.php file :-
Make sure we have added "Paypal" as an option for payment methods on the checkout page.

3) Update checkout function:-
Now update the checkout function at ProductsController to add a condition to redirect the user to the Paypal page if the user selects Paypal at the checkout page.

4) Create Route:-
Now we will create Paypal Route in the web.php file:-

// Paypal
Route::get('/paypal','PaypalController@paypal');

5) Create paypal function :-
Now create paypal function at PaypalController which looks similar to the thanks function that we have done earlier for COD. In the Paypal function, we are going to return to paypal blade file.

6) Create paypal.blade.php file :-
Now create paypal folder under /resources/views/front/ folder and then create paypal.blade.php file under it. We will copy the content from thanks.blade.php file and will add Paypal form to this page to make payment.

7) Create Paypal Sandbox Account
Now create Paypal Sandbox Account at https://developer.paypal.com/ and create App to get client id and secrect id and create test business account to make test payment.

8) Create Payment Model / "payments" Table
Now create Payment Model & migration file to create "payments" table with below artisan command:
php artisan make:model Payment -m

Open newly created Migration file and add required columns and run below command to create payments table:
php artisan migrate

9) Install Omnipay Paypal Package
Now let's install a package that we are going to use to integrate PayPal api into our application:
composer require league/omnipay omnipay/paypal

10) Update .env file
Update .env file with PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET and PAYPAL_CURRENCY

To be continued...

►Laravel 9 Tutorial Playlist (Create Multi-Vendor E-commerce Website) -    • Laravel Multi Vendor Tutorial  

►Click here to subscribe for Laravel & other updates -    / stackdevelopers  

Popular Stack Developers Series that can help you:-

►React JS Tutorial for Beginners with Laravel 9 -    • React JS Tutorial with Laravel for Beginners  

►Laravel Tutorial for Beginners -    • Laravel Tutorial for Beginners | Advance E...  

►GIT Tutorial for Beginners -    • Git Tutorial for Beginners | Create your F...  

►Laravel API Tutorial -    • Laravel API Tutorial | Create API from Scr...  

►Laravel Interview Questions -    • Laravel Interview Questions & Answers | 20...  

►jQuery Tutorial -    • jQuery Tutorial  

►Laravel Basic E-commerce Series -    • Make Admin Panel / E-commerce Website in L...  

►Laravel Dating Series -    • Make Dating / Social Networking Website in...  

►Join this channel to get the complete source code of all series:
   / @stackdevelopers  

Follow Stack Developers on Social Media to get updates and resolve your queries
►Like Facebook Page to get updates -   / stackdevelopers2  
►Join Facebook Group to resolve your queries -   / stackdevelopers  
►Follow on Instagram -   / stackdevelopers2  
►Follow on GitHub - https://github.com/stackdevelopers

#laravel9 #laravel9tutorial #laravel