How to Intergrate Instamojo Payment Gateway in Laravel 8 App

How to Intergrate Instamojo Payment Gateway in Laravel 8 App

In this Laravel 8 tutorial, you will learn how to intergrate Instamojo Payment Gateway in Laravel 8 App. We will show you each thing step by step on how to integrate Instamojo Payment in Laravel 8 App.

Laravel 8 instamojo payment gateway integration example. In this tutorial, you will learn how to integrate the instamojo payment gateway in the php laravel 8 application via the instamojo PHP package.

Now, we will show you each thing step by step on how to integrate Instamojo payment in laravel 8 app.

Laravel 8 Instamojo Payment Gateway Integration Example

  • Step 1: Install Laravel 8 App
  • Step 2: Connecting App to Database
  • Step 3: Install Instamojo PHP package
  • Step 4: Configure Instamojo Package
  • Step 5: Make Model and Migration
  • Step 6: Create Controller
  • Step 7: Make Routes
  • Step 8: Create Blade View file
  • Step 9: Start Development Server

Step 1: Install Laravel 8 App

In this step, install Laravel 8 application by executing the following command on terminal:

composer create-project --prefer-dist laravel/laravel blog

Step 2: Connecting App to Database

In this step, visit laravel 8 app root directory and open .env file. Then add the database details:

  DB_CONNECTION=mysql 
  DB_HOST=127.0.0.1 
  DB_PORT=3306 
  DB_DATABASE=here your database name here
  DB_USERNAME=here database username here
  DB_PASSWORD=here database password here

Step 3: Install Instamojo PHP package

In this step, execute the following command on terminal to install instamojo package:

composer require instamojo/instamojo-php

Step 4: Configure Instamojo Package

In this step, visit the instamojo.com and create account on it. Then you will get client id and secret from instamojo.

After that, open the .env file And set the API key, auth-token and URL in .env file like the following:

 IM_API_KEY=test_d883b3a8d2bc1adc7a535506713
 IM_AUTH_TOKEN=test_dc229039d2232a260a2df3f7502
 IM_URL=https://test.instamojo.com/api/1.1/

Next, Open services.php file and add the following code into it, which is inside app/config directory:

'instamojo' => [

    'api_key'       => env('IM_API_KEY'),

    'auth_token'    => env('IM_AUTH_TOKEN'),

    'url'           => env('IM_URL'),

],

Step 5: Make Model & Migration

In this step, create table name Payment and it’s migration file. use the below command.

php artisan make:model Payment -m

It command will create one model name Payment and also create one migration file for the Payment table. After successfully run the command go to database/migrations/Payments.php file and replace function, below here :

public function up()
 {
 Schema::create('payments', function (Blueprint $table) {
 $table->increments('id');
 $table->string('i_payment_id');
 $table->string('user_id');
 $table->string('amount');
 $table->timestamps();
 });
 }

Next, migrate the table using the below command. It will create two new tables in the database.

php artisan migrate

laravel php web-development programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...

PHP Website Development

Skenix Infotech is a leading PHP Web Development Company that helps companies get results with industry best practices. Get affordable PHP Development Services.

Laravel Development Company

Skenix Infotech is a top Laravel Website Development Company with Expert Laravel Developers that provides robust Laravel Development Services at fair costs.

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer](https://hourlydeveloper.io/hire-dedicated-php-developer/ "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

Hire PHP Developer

Looking to develop a PHP based website from scratch or revamp your existing website? **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")** has always been an industry leader for companies and business owners looking to hire...