Today, I am going to show you How to integrate paypal payment gateway in our Laravel application. In this tutorial i explain step by step example code of How to integrate paypal payment gateway.
Here i give you full example of How to integrate paypal payment gateway step by step like create laravel project, migration, model, route, blade file etc. So you have to just follow few step as listed bellow.
Follow Bellow Few Step:
1)Install Laravel Application
2)Database Configuration
3)Install Required Packages
4)configuration paypal.php file
5)create route
6)create controller
7)create view file
Step 1 : Install Laravel Application
we are going from scratch, So we require to get fresh Laravel application using bellow command, So open your terminal OR command prompt and run bellow command:
composer create-project --prefer-dist laravel/laravel blog
Step 2 : Database Configuration
In this step, we require to make database configuration, you have to add following details on your .env file.
1.Database Username
1.Database Password
1.Database Name
In .env file also available host and port details, you can configure all details as in your system, So you can put like as bellow:
.env
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Step 3 : Install Required Packages
We have required following 2 packages for integrate paypal payment in our laravel application.
add following two package in your composer.json file.
"guzzlehttp/guzzle": "~5.2",
"paypal/rest-api-sdk-php": "*",
then after run following command in your terminal
php artisan vendore:publlish
after run this command, then after automatic create paypal.php file in your config/paypal.php path.
Step 4 : Configuration paypal.php file