By Hardik Savani March 6, 2021 Category : LaravelPlayUnmuteLoaded: 1.15%FullscreenNow, let's see tutorial of razorpay payment gateway integration in laravel. it's simple example of laravel razorpay pay example. Here you will learn laravel razorpay integration. I’m going to show you about razorpay integration in laravel. you will do the following things for razorpay api integration in laravel.
you can easily integrate razorpay payment gateway in laravel 6, laravel 7, laravel 8 and laravel 9 app.
razorpay payment gateway is for india. they provide lot's of option like credit card, debit card, UPI, phone pay, google pay, paytm payment option to do payment of user. so if you want to implement razorpay integration in your laravel app then you can do it by following bellow few steps. you can see bellow preview too:
Preview:
Step 1: Install Laravel
first of all we need to get fresh Laravel version 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: Create Razorpay Account
First you need to create account on razorpay. then you can easily get account key id and key secret.
In this step, we need to install razorpay/razorpay composer package to use razorpay api. so let's run bellow command:
composer require razorpay/razorpay
Step 4: Create Route
now we will create one route for calling our example, so let's add new route to web.php file as bellow:
routes/web.php
<?php use Illuminate\Support\Facades\Route; use App\Http\Controllers\RazorpayPaymentController; /*|--------------------------------------------------------------------------| Web Routes|--------------------------------------------------------------------------|| Here is where you can register web routes for your application. These| routes are loaded by the RouteServiceProvider within a group which| contains the "web" middleware group. Now create something great!|*/ Route::get('razorpay-payment', [RazorpayPaymentController::class, 'index']);Route::post('razorpay-payment', [RazorpayPaymentController::class, 'store'])->name('razorpay.payment.store');
Step 5: Create Controller
in this step, we will create RazorpayPaymentController and write send sms logic, so let's add new route to web.php file as bellow: