Laravel 6 Paypal Payment Integrate Example

Laravel 6 Paypal Payment Integrate Example

In this tutorial, we will tell you how to integrate the Paypal payment gateway in the Laravel Framework(Laravel 6 Paypal Payment Integrate Example).

The Paypal payment gateway is a popular payment gateway method and it is easily used for the project. so many developers prefer that payment gateway method.

PayPal is a secure payment method and it’s work-based using API. it provides two environments for the user like a sandbox and live.

Overview

Step 1: Install Laravel 6

Step 2: Setting Database Configuration

Step 3: Create Table using migration

Step 4: Install Package

Step 5: Get and Set Stripe API Key and SECRET

Step 6: Create Route

Step 7: Create a Model and Controller

Step 8: Create Blade File

Step 9: Run Our Laravel Application

Laravel 6 Paypal Payment Integrate Example

Step 1: Install Laravel 6

We are going to install laravel 6, so first open the command prompt or terminal and go to go to xampp htdocs folder directory using the command prompt. after then run the below command.

Step 2: Setting Database Configuration
After the complete installation of laravel. we have to database configuration. now we will open the .env file and change the database name, username, password in the .env file. See below changes in a .env file.

Step 3: Create Table using migration
Now, We need to create a migration. so we will below command using create the payments table migration.

After complete migration. we need below changes in the database/migrations/create_payments_table file.

Run the below command. after the changes above file.

Step 4: Install Package

Now, we are going to install the  “omnipay/paypal” package using the below command.

Step 5: Get and Set Stripe API Key and SECRET

Now, we have to need PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET. so we will go to the official Paypal site and after then login gets PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET after then we will set in the .env file.

Step 6: Create Route

Add the following route code in the “routes/web.php” file.

Step 7: Create a Model and Controller

Now, We will create the controller using the below command and paste the below code in this controller.

PaymentController.php

Payment.php

Step 6: Create Blade File

So finally, we will create the payment.tpl file in “resources/views/” directory.

Step 9: Run Our Laravel Application
We can start the server and run this example using the below command.

Now we will run our example using the below Url in the browser.

Please follow and like us: