DEV Community

Sachin Sanchania
Sachin Sanchania

Posted on

Integrate ICICI Bank’s Eazypay Gateway Seamlessly in Laravel

Handling payment gateways can be challenging — from generating checksums to managing callbacks securely. That’s why I built Laravel Eazypay Integration — a simple yet powerful Laravel package for integrating ICICI Bank’s Eazypay Payment Gateway into your PHP or Laravel applications.

This package makes it effortless to handle:

  • 🔑 Checksum generation & validation
  • 💳 Secure transaction submission
  • 📩 Callback & response handling

It’s designed for Laravel 10/11 and supports PHP 8+, ensuring smooth integration and up-to-date compatibility.


💡 What is Eazypay?

Eazypay is a secure and versatile payment service offered by ICICI Bank in India.
It allows institutions and businesses to collect money through multiple payment modes like NetBanking, Cards, UPI, NEFT/RTGS, Cash, and Cheque — all through a unified interface.

With Laravel Eazypay, you can integrate this payment gateway directly into your Laravel project with minimal setup and maximum security.


⚙️ Installation

You can install the package using Composer:

composer require sachin-sanchania/laravel-eazypay
Enter fullscreen mode Exit fullscreen mode

⚡ Configuration

The configuration is designed to be flexible and developer-friendly.

Global configuration can be found in:

config/eazypay.php
Enter fullscreen mode Exit fullscreen mode

Step 1: Update your .env file

Make sure you add the following credentials provided by ICICI Bank:

EAZYPAY_MERCHANT_ID=your_merchant_id
EAZYPAY_ENCRYPTION_KEY=your_encryption_key
EAZYPAY_RETURN_URL=your_return_url
EAZYPAY_SUB_MERCHANT_ID=xxxxxx
EAZYPAY_PAYMODE=9
EAZYPAY_DEFAULT_BASE_URL=https://eazypay.icicibank.com/EazyPG
Enter fullscreen mode Exit fullscreen mode

💡 Tip: For UAT testing, use
https://eazypayuat.icicibank.com/EazyPG
as the base URL.

Step 2: Clear your application cache

php artisan optimize:clear
Enter fullscreen mode Exit fullscreen mode

Step 3: Publish the configuration file

php artisan vendor:publish --provider="SachinSanchania\Eazypay\EazypayServiceProvider"
Enter fullscreen mode Exit fullscreen mode

That’s it! Your Laravel app is now ready to communicate with ICICI’s Eazypay gateway.


🧩 Usage

Once installed and configured, you can easily initiate a payment request and handle the response.

Step 1: Initiate a Payment

Import the package into your controller and call the payment method:

use SachinSanchania\Eazypay\Eazypay;

class PaymentController extends Controller
{ 
    public function payment()
    {
        $amount        = 1000;
        $referenceNo   = 1; // Order ID or unique transaction reference
        $optionalField = '10|10|10|10'; // Optional fields as per ICICI docs

        $eazypay    = new Eazypay();
        $paymentUrl = $eazypay->getPaymentUrl($amount, $referenceNo, $optionalField);

        return redirect()->to($paymentUrl); // Redirect to ICICI Eazypay gateway
    }
}
Enter fullscreen mode Exit fullscreen mode

This generates a secure checksum, prepares the transaction data, and redirects the customer to the payment page.


Step 2: Handle the Payment Response

After the payment process, ICICI Eazypay will redirect the customer to your Return URL with the transaction response.
Here’s how you can capture and handle it:

public function paymentResponse(Request $request)
{
    $response = $request->all();

    // Validate and process payment response
    if (isset($response['status']) && $response['status'] == 'success') {
        // Payment successful
        // Update order or transaction status here
    } else {
        // Payment failed or pending
        // Handle accordingly
    }

    return view('payment.status', compact('response'));
}
Enter fullscreen mode Exit fullscreen mode

🧾 Example Flow

  1. Customer initiates payment on your site.
  2. Your application sends the payment request to Eazypay via this package.
  3. The user completes payment on ICICI’s portal.
  4. ICICI redirects back to your configured Return URL with transaction details.
  5. You verify the checksum and update your database accordingly.

🛠 Supported Payment Modes

Mode Code
Cash 0
Cheque 1
NEFT/RTGS 2
Net Banking 3
Debit Card 4
Credit Card 5
UPI 6
All 9 (default)

🔒 Security

All sensitive data is encrypted using ICICI’s AES encryption.
The library automatically handles checksum generation and validation for each transaction, ensuring end-to-end integrity and security.


📦 Repository

View full documentation and source code here:
👉 https://github.com/sachin-sanchania/laravel-eazypay


❤️ Contributing

Contributions are always welcome!
If you’d like to improve functionality, fix a bug, or add features — open a PR or start a discussion on GitHub.


🧾 License

Licensed under the MIT License — free to use and modify for both personal and commercial projects.


Thanks for your support! ❤️
If this package helps you simplify Eazypay integration, don’t forget to ⭐ star the repository on GitHub and share it with the Laravel community.


Author: Sachin Sanchania
Follow me on Dev.to OR sachinsanchania.com for more Laravel and PHP open-source updates.

Top comments (0)