Laravel 6 Paytm Payment Gateway Integration E.g. Tutorial

How to integrate paytm payment gateway in the laravel 6 application. In this tutorial, we’ll discuss step by step how to integrate paytm payment gateway in our laravel 6 App using anandsiddharth/laravel-paytm-wallet package. In this example, we will integrate the paytm payment gateway in a simple and easy way.

And this paytm payment gateway example also works with laravel 5.8, 5.7 version.

Paytm is a very popular company. Paytm provide a payment gateway in many different languages like PHP, Java, .Net, Node.js, Ruby on Rails, Perl, Python, Express.

Sometimes we found invalid checksum error in paytm payment gateway SDK. We have resolved invalid checksum error in integrating the paytm payment gateway.


  • Install laravel 6 Fresh Setup
  • Configuration .env file
  • Install Anandsiddharth paytm package
  • Generate Migration and Create Model
  • Make Route
  • Create Controller
  • Create Blade View file
  • Start Development Server
  • Conclusion

Install laravel 6 Fresh Project

We need to install laravel 6 fresh application using below command, Open your command prompt and run the below command :

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

After successfully install laravel 6 Application, Go to your project .env file and set up database credential and move next step.

Configuration in .env

In this step, we will set database credential in .env file. Let’s open .env file.

DB_DATABASE=your database name here
DB_USERNAME=database username here
DB_PASSWORD=database password here

Install Anandsiddharth paytm package

Use the below command and install the package :

composer require anandsiddharth/laravel-paytm-wallet

After successfully install the package, we need to register the provider and alias. Go to the app/config/app.php and put the below lines here :

'providers' => [
// Other service providers…
'aliases' => [
// Other aliases
'PaytmWallet' => Anand\LaravelPaytmWallet\Facades\PaytmWallet::class,

We need to set a paytm credential like below. Go to the app/config/services.php and set the paytm credential.

'paytm-wallet' => [
'env' => 'production', // values : (local | production)
'merchant_id' => 'YOUR_MERCHANT_ID',
'merchant_key' => 'YOUR_MERCHANT_KEY',
'merchant_website' => 'YOUR_WEBSITE',
'channel' => 'YOUR_CHANNEL',
'industry_type' => 'YOUR_INDUSTRY_TYPE',

All the credentials mentioned are provided by Paytm after signing up as a merchant.

Generate Migration and Create Model

Now we will Create table name notes and it’s migration file. use the below command :

php artisan make:model Event -m

Its command will create one model name Event and also create one migration file for the events table. After successfully run the command go to database/migrations file and put the below here :

use Illuminate\Support\Facades\Schema; 
use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 
class CreateEventsTable extends Migration 
     * Run the migrations. 
     * @return void 
    public function up() 
        Schema::create('products', function (Blueprint $table) { 
     * Reverse the migrations. 
     * @return void 
    public function down() 

Next, migrate the table using the below command.

php artisan migrate

Now, add the fillable property inside the Event.php file.

namespace App;
use Illuminate\Database\Eloquent\Model;
class Note extends Model
  protected $fillable = ['name','mobile_number',

Make Route


Route::get('event', '[email protected]');
Route::post('payment', '[email protected]');
Route::post('payment/status', '[email protected]');

Create Controller

Create the controller name EventController using the below command.

php artisan make:controller EventController

Go to app/HTTP/Controller/EventController and put the below code :


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Event;
use PaytmWallet;

class EventController extends Controller

     * Redirect the user to the Payment Gateway.
     * @return Response
    public function bookEvent()
        return view('book_event');

     * Redirect the user to the Payment Gateway.
     * @return Response
    public function eventOrderGen(Request $request)
     $this->validate($request, [
          'name' => 'required',
          'mobile_no' =>'required|numeric|digits:10|unique:events,mobile_number',

        $input = $request->all();
        $input['order_id'] = rand(1111,9999);
        $input['amount'] = 50;


        $payment = PaytmWallet::with('receive');
          'order' => $input['order_id'],
          'user' => 'user id',
          'mobile_number' => $request->mobile_number,
          'email' => $request->email,
          'amount' => $input['amount'],
          'callback_url' => url('payment/status')
        return $payment->receive();

     * Obtain the payment information.
     * @return Object
    public function paymentCallback()
        $transaction = PaytmWallet::with('receive');

        $response = $transaction->response();

          Event::where('order_id',$response['ORDERID'])->update(['status'=>'success', 'payment_id'=>$response['TXNID']]);

          dd('Payment Successfully Credited.');

        }else if($transaction->isFailed()){
          Event::where('order_id',$order_id)->update(['status'=>'failed', 'payment_id'=>$response['TXNID']]);
          dd('Payment Failed. Try again lator');

Create Blade View file

We need to create blade views file, Go to app/resources/views/ and create one file name event.blade.php :

<!DOCTYPE html>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>Paytm Payment Gateway Integrate -</title>
    <link href="" rel="stylesheet">
            margin-top: 40px;
<div class="container">

<div class="row">
    <div class="col-lg-12 mt40">
        <div class="card-header" style="background: #0275D8;">
            <h2>Register for Event</h2>
@if ($errors->any())
    <div class="alert alert-danger">
        <strong>Whoops!</strong> Something went wrong<br>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
<form action="{{ url('payment') }}" method="POST" name="paytm">
    {{ csrf_field() }}
     <div class="row">
        <div class="col-md-12">
            <div class="form-group">
                <input type="text" name="name" class="form-control" placeholder="Enter Name">
        <div class="col-md-12">
            <div class="form-group">
                <strong>Mobile Number</strong>
                <input type="text" name="mobile_number" class="form-control" placeholder="Enter Mobile Number">
        <div class="col-md-12">
            <div class="form-group">
                <strong>Email Id</strong>
                <input type="text" name="email" class="form-control" placeholder="Enter Email id">
        <div class="col-md-12">
            <div class="form-group">
                <strong>Event Fees</strong>
                <input type="text" name="amount" class="form-control" placeholder="" value="100" readonly="">
        <div class="col-md-12">
                <button type="submit" class="btn btn-primary">Submit</button>

Start Development Server

In this step, we will use the PHP artisan serve command. It will start your server locally

php artisan serve

If you want to run the project diffrent port so use this below command

php artisan serve --port=8080

Now we are ready to run our example so run bellow command to quick run.


Or direct hit in your browser


Testing Card Credential
 Card No : 4242424242424242
Month : any future month
Year : any future Year
CVV : 123
Password : 123123


In this tutorial, We have successfully integrated paytm payment gateway in the laravel 6 Application. Our examples run quickly.


If you found any invalid checksum issue in this laravel paytm package. Go to App/vendor/anandsiddharth/laravel-paytm-wallet/lib/encdec_paytm.php file. Next, file the function checkString_e() and replace the function to below code here :

 function checkString_e($value) {
$myvalue = ltrim($value);
$myvalue = rtrim($myvalue);
if (in_array($myvalue, ['null', 'NULL']))
$myvalue = '';
return $myvalue;

after putting the code and run your project again. if you still found this issue contact on paytm customer support and active your wallet credential.

If you have any questions or thoughts to share, use the comment form below to reach us.


  1. Shelia said:

    I think this is among the most important information for me.
    And i am glad reading your article. But should remark
    on few general things, The site style is ideal, the articles is really great : D.
    Good job, cheers

    my webpage: Jesus

    January 6, 2021
  2. Omer said:

    You really make it seem so easy with your presentation but I
    find this topic to be really something which I think I would never understand.
    It seems too complex and very broad for me. I am looking
    forward for your next post, I’ll try to get the hang of it!

    Here is my webpage … cheap flights

    January 31, 2021
  3. Soila said:

    Hi there! I realize this is sort of off-topic but I needed to ask.
    Does building a well-established website like yours
    require a large amount of work? I’m brand new to operating a
    blog but I do write in my journal everyday. I’d like to start a blog so I can share my own experience and views
    online. Please let me know if you have any suggestions or tips
    for brand new aspiring blog owners. Appreciate it!

    My web blog … cheap flights

    February 1, 2021
  4. Harlan said:

    These are actually impressive ideas in about blogging.

    You have touched some good points here. Any way keep
    up wrinting.

    Review my page: cheap flights –,

    February 2, 2021
  5. Earle said:

    I blog frequently and I really thank you for your content. Your article has truly peaked my interest.
    I will bookmark your blog and keep checking for new information about once a week.
    I subscribed to your Feed too.

    Feel free to visit my webpage … cheap flights

    February 2, 2021
  6. Raquel said:

    Hi there to every , because I am in fact keen of reading this website’s post to be updated regularly.
    It contains good information.

    My website – cheap flights,,

    February 3, 2021
  7. Antje said:

    Thank you for the auspicious writeup. It if truth be told was once a leisure account it.
    Glance complex to far delivered agreeable from you!
    However, how can we be in contact?

    My web page: cheap flights –,

    February 12, 2021
  8. Sabrina said:

    Oh my goodness! Amazing article dude! Thank you so much, However I am
    encountering problems with your RSS. I don’t know the reason why I cannot join it.
    Is there anyone else getting identical RSS problems?
    Anybody who knows the answer can you kindly respond?

    Here is my homepage: Maxie

    February 22, 2021
  9. Frederick said:

    Please refer to the updated date and time information above the odds

    Here is my website; free online sports betting

    February 22, 2021
  10. Janie said:

    It is safe to say that decimal odds are the most
    well known system for displaying odds out there.

    my page; online casino games

    February 22, 2021
  11. Hans said:

    Hi, i think that i saw you visited my website thus i came to
    “return the favor”.I am trying to find things to enhance my website!I suppose its ok to use a few of your ideas!!

    Also visit my web blog … mega888 ios (

    February 22, 2021
  12. Josette said:

    The organization said added announcements will be forthcoming.

    my web-site; click here

    February 22, 2021
  13. Paula said:

    I blog often and I genuinely appreciate your content.

    The article has truly peaked my interest. I will take a
    note of your website and keep checking for new information about once a week.
    I opted in for your Feed too.

    My page – online game xe88

    February 22, 2021
  14. Hildegarde said:

    During this time EA formed EA Sports, a brand name utilized for sports
    games they made.

    Review my site – betting advice

    February 22, 2021
  15. Breanna said:

    The full odds are then paid to the divided stake with the remainder
    of the revenue being lost.

    Look at my web-site: sports betting services

    February 22, 2021
  16. Cyrus said:

    Hi to every one, since I am actually eager of reading this webpage’s post to be updated daily.

    It includes pleasant stuff.

    my site: poppers uk

    February 22, 2021
  17. Cole said:

    In some, there are no restrictions, when other people prohibit betting
    on any in-state programs or events.

    Here is my site … online sports books

    February 22, 2021
  18. Wilford said:

    Locating worth is one of the secrets to making money from something
    in life.

    Feel free to visit my web site – 메이저토토사이트

    February 22, 2021
  19. Williams said:

    The successor of a title that gave birth to an whole genre, DOTA 2 is the second-largest MOBA title on the esports scene.

    Also visit my web-site; world cup spread betting

    February 22, 2021
  20. Raleigh said:

    I wanted to thank you for this good read!! I absolutely enjoyed every bit of it.
    I have got you book-marked to look at new stuff you post…

    My webpage … download mega888 ios

    February 22, 2021
  21. Lincoln said:

    It’s not my first time to pay a quick visit this web site, i am browsing
    this website dailly and take fastidious facts from here daily.

    Feel free to surf to my web blog :: Room Aromas

    February 22, 2021
  22. Preston said:

    Wow, awesome weblog format! How long have you been blogging
    for? you make blogging look easy. The total look of your
    web site is excellent, let alone the content!

    Here is my blog post: xe88

    February 23, 2021
  23. Karolyn said:

    The 1st time in history that an intervention that the US government has thrown billions of
    dollars at has been described as a victory “against
    all odds”.

    Feel free to surf to my webpage: online sports books

    February 23, 2021
  24. Jamaal said:

    Hmm is аnyone else haing problems with the pictures on this blog
    loading? I’m trying to figure out if itts a problem
    on my end or if it’s the blog. Any resⲣ᧐nsеs woulԀ be greatly аppreciated.

    my page:pasang baja ringan atap spandek

    February 24, 2021
  25. Matthew said:

    On the net casinos aren’t all that various from their brick-and-mortar counterparts.

    my web blog best online casino

    February 24, 2021
  26. Kevin said:

    Right here is the perfect webpage for anybody who would like to understand this topic.
    You understand a whole lot its almost tough to argue with you (not that I actually would want
    to…HaHa). You certainly put a new spin on a topic that’s been discussed for a
    long time. Excellent stuff, just great!

    Here is my site Odell

    February 24, 2021
  27. Dominique said:

    Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You clearly know what youre talking about, why waste
    your intelligence on just posting videos to your site when you could
    be giving us something informative to read?

    My homepage; Lonny

    February 24, 2021
  28. Willy said:

    Good day! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to
    get my blog to rank for some targeted keywords but I’m
    not seeing very good results. If you know of any please share.
    Appreciate it!

    My blog post … Marcia

    February 24, 2021
  29. Jess said:

    But as other states like neighboring Mississippi move
    promptly to legalize sports gambling, he said, “we’re behind everybody.”

    Also visit my blog post … find online casino

    February 24, 2021
  30. Ariel said:

    A prop bet is an further way to wager on a game or occasion, with quite a few
    props revolving around player performances.

    My web site: usa online casino

    February 24, 2021
  31. Fanny said:

    It’s as uncomplicated as navigating to a webpage to make your bets.

    Here is my webpage … 스포츠토토

    February 24, 2021
  32. Coleman said:

    Integrated in the live system will be a trip to Fenway Park to
    see the Red Sox play.

    Here is my web-site – play online

    February 25, 2021
  33. Margery said:

    By the 90s, there was considerable stress to reconsider the legality of slots,
    especially due to competitors from neighboring states.

    My web site; betting sports

    February 25, 2021

Leave a Reply

Your email address will not be published. Required fields are marked *