Laravel 9 Instamojo Payment Gateway Integration Example

In this tutorial you will learn about the Laravel 9 Instamojo Payment Gateway Integration Example and its application with practical example.

In this Laravel 9 Instamojo Payment Gateway Integration Example tutorial I will show you How to Integrate Instamojo Payment Gateway in Laravel 9. In this tutorial, we will learn how to integrate the instamojo payment gateway in php laravel 9 application via the instamojo PHP package.

Instamojo Payment Gateway

Instamojo is one of the popular payment gateway, that allows us to accept payment from your customer. Instamojo is very simple, hassle free and easy to integrate payment gateway.  Instamojo processes refund payments, collect a payment, create payment are very easy and simple.

Laravel 9 Instamojo Payment Gateway Integration Example

In this step by step tutorial I will demonstrate you to integrate instamojo payment gateway in the laravel 9 application without using curl APIs. We will simply install instamojo PHP package and integrate into our lastest laravel based application.

  • Install Laravel 9
  • Connecting App to Database
  • Install Instamojo PHP package
  • Configure Instamojo Package
  • Make Model and Migration
  • Create Controller
  • Make Routes
  • Create Blade View file
  • Start Development Server

Install Laravel 9

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

Connecting App to Database

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Install Instamojo PHP package

In this step, we will install Instamojo PHP package via the composer dependency manager. Use the following command to install Instamojo PHP package.

Configure Instamojo Package

Now, we will put following configuration detail in .env file:

Next, Go to the app/config/services.php and put the below code here.

Make Model & Migration

Now, in this step we will create model and migration file. Please run the following command:

Once above command is executed there will be a migration file created inside database/migrations/ directory, just open migration file and update the function up() method as following:

Now, in this step we will create model and migration file. Please run the following command:

Create Controller

Now, lets create a controller named PayController using command given below –

Go to app/Http/Controller/PayController.php and put the below code :

Make Routes

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

Create Blade View file

In this step we will create blade file. Go to resources/views directory and create blade view file name event.blade.php. Then put the following code into event.blade.php:

Start 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 Laravel 9 Instamojo Payment Gateway Integration Example and its application with practical example. I hope you will like this tutorial.