Razorpay Payment Gateway Integration in Laravel 8 Tutorial

In this tutorial you will learn about the Razorpay Payment Gateway Integration in Laravel 8 Tutorial and its application with practical example.

In this Razorpay Payment Gateway Integration in Laravel 8 Tutorial, I’ll show you how to integrate Razorpay in laravel 8 to collect payment. In this tutorial you will learn to integrate Razorpay in laravel 8. In this article I will share example to integrate Razorpay Payment Gateway in laravel 8 application.

Razorpay Payment Gateway

Razorpay is one of the popular payment gateway, that allows us to accept payment from your customer. Razorpay is very simple, hassle free and easy to integrate payment gateway. Integrating Razorpay payment gateway in laravel 8 is a breeze. Before starting with this tutorial you would require a Razorpay developer account, from there you will get the api key and secret key require for the integration.

Razorpay Payment Gateway Integration in Laravel 8 Tutorial

In this tutorial, you will learn to integrate Razorpay payment gateway in your laravel 8 project. Follow this step by step tutorial to learn Razorpay payment gateway integration in laravel 8.

Step 1: Install Laravel

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2: Create Razorpay Account

In this step you need to create account on razorpay website and get account key id and secret. Then you need to add on .env file as following:

Step 3: Install razorpay/razorpay Package

In this step, we will install razorpay Package via the composer dependency manager. Use the following command to install razorpay Package.

Step 4: Create Route

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 5: Create Controller

Now, lets create a controller for Razorpay Payments. Create a controller named RazorpayPaymentController and put the following code in it:

app/Http/Controllers/RazorpayPaymentController.php

Step 6: Create Blade File

In this step, we will create view/blade file to accept razorpay payment. Lets create a blad filerazorpayView.blade.php” in “resources/views/” directory and put the following code in it respectively.

resources/views/razorpayView.blade.php

Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

In this tutorial we have learn about the Razorpay Payment Gateway Integration in Laravel 8 Tutorial and its application with practical example. I hope you will like this tutorial.