
Laravel EazyPay is a powerful Laravel package that simplifies the integration of ICICI Bank’s EazyPay Payment Gateway into your Laravel applications. Developed by Sachin Sanchania, this package eliminates the complexity of payment gateway integration, allowing developers to implement secure payment processing with minimal code. Whether you’re building an e-commerce platform, subscription service, or any application requiring online payments, Laravel EazyPay provides a seamless solution for accepting payments through multiple payment modes offered by ICICI Bank. With this package, you can quickly enable Eazypay in your project without writing the low-level integration yourself — saving development time and reducing risk.
GitHub Repository: https://github.com/sachin-sanchania/laravel-eazypay
What Is Eazypay?
Eazypay is a first of its kind secure payment service by ICICI Bank in India. It enables institutions to collect money from their customers through multiple payment modes. ICICI Bank is the first and only bank to offer such a payment service in India.
Key Features of Laravel EazyPay
- Checksum Generation & Validation : The package simplifies generation of the required checksum and validation of responses from the gateway.
- Secure Transaction Submission : Handles sending payment details securely to the Eazypay gateway endpoint.
- Callback / Response Handling : Offers controllers/methods to capture the return URL response and act accordingly (success/failure).
- Laravel 10/11 & PHP 8+ Compatible : Built to work with the latest versions of Laravel and PHP for modern development.
- Configurable via .env & Config File : You set merchant ID, encryption key, return URL and more via config file and environment variables.
Benefits of Using Laravel EazyPay
- Reduced Development Time : Instead of building gateway integration from scratch, you use the ready-made package.
- Consistency & Reliability : Adheres to ICICI Bank’s Eazypay specifications, reducing errors.
- Secure Gateway Integration : Built-in support for encryption key, checksum, and secure flow.
- Maintenance & Updates : The package is open-source (MIT license) and maintained, making future updates easier.
- Fits Laravel Ecosystem : Leverages Laravel’s features (controllers, facades, config) making it easy to adopt.
Installation & Configuration Guide
Step 1: Install via Composer
Begin by installing the package through Composer, Laravel’s dependency manager:
composer require sachin-sanchania/laravel-eazypay
Step 2: Publish Configuration File
Publish the package’s configuration file to your Laravel application:
php artisan vendor:publish --provider="SachinSanchania\Eazypay\EazypayServiceProvider"
This command creates a configuration file at config/eazypay.php where you can customize various settings.
Step 3: Configure Environment Variables
Add the following credentials to your .env file. These credentials are provided by ICICI Bank upon merchant registration:
EAZYPAY_MERCHANT_ID=your_merchant_id // 6 digit Eazypay ICID shared by ICICI Bank
EAZYPAY_ENCRYPTION_KEY=your_encryption_key // AES Key shared by ICICI Bank
EAZYPAY_RETURN_URL=your_return_url // Return URL configured while merchant registration in eazypay. Transaction response is sent to this URL.
EAZYPAY_SUB_MERCHANT_ID=xxxxxxxx // A numeric value that can be customized by the merchant andused to differentiate between internal business units of the mer-chant (if applicable).
EAZYPAY_PAYMODE=9 // (Optional | Default=9) Cash=0,Cheque=1,NEFT/RTGS=2,NetBanking=3,DebitCard=4,CreditCard=5 and UPI = 6 and All=9
EAZYPAY_DEFAULT_BASE_URL=xxxxxx // (Optional | Default=https://eazypay.icicibank.com/EazyPG?) For UAT set this url : https://eazypayuat.icicibank.com/EazyPG
Configuration Parameters Explained:
- EAZYPAY_MERCHANT_ID: Your 6-digit ICID provided by ICICI Bank
- EAZYPAY_ENCRYPTION_KEY: AES encryption key shared by ICICI Bank
- EAZYPAY_RETURN_URL: The callback URL where ICICI will send transaction responses
- EAZYPAY_SUB_MERCHANT_ID: Optional identifier for internal business units
- EAZYPAY_PAYMODE: Payment mode (0=Cash, 1=Cheque, 2=NEFT/RTGS, 3=NetBanking, 4=DebitCard, 5=CreditCard, 6=UPI, 9=All)
- EAZYPAY_DEFAULT_BASE_URL: Gateway URL (use UAT URL for testing:
https://eazypayuat.icicibank.com/EazyPG)
Step 4: Clear Application Cache
After configuration, clear your application cache:
php artisan optimize:clear
Practical Implementation with Code Examples
Example 1: Basic Payment Initiation
Create a payment controller to handle payment requests:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use SachinSanchania\Eazypay\Eazypay;
class PaymentController extends Controller
{
public function initiatePayment()
{
// Payment amount in INR
$amount = 1000.00;
// Unique reference number (order ID, invoice number, etc.)
$referenceNo = 'ORDER_' . time();
// Optional fields in pipe-delimited format
$optionalField = '10|10|10|10';
// Create Eazypay instance
$eazypay = new Eazypay();
// Generate payment URL with checksum
$paymentUrl = $eazypay->getPaymentUrl($amount, $referenceNo, $optionalField);
// Redirect user to ICICI Eazypay gateway
return redirect()->to($paymentUrl);
}
}
Example 2: Handling Payment Response
Create a method to capture and process the payment gateway response:
public function paymentResponse(Request $request)
{
// Capture all response parameters
$response = $request->all();
// Extract key response parameters
$transactionStatus = $response['Response_Code'] ?? null;
$referenceNo = $response['Unique_Ref_Number'] ?? null;
$amount = $response['Transaction_Amount'] ?? null;
$transactionId = $response['Transaction_ID'] ?? null;
// Validate and process based on status
if ($transactionStatus == 'E000') {
// Transaction successful
$this->updateOrderStatus($referenceNo, 'paid', $transactionId);
return view('payment.success', [
'message' => 'Payment processed successfully!',
'transactionId' => $transactionId,
'amount' => $amount
]);
} else {
// Transaction failed or pending
$this->updateOrderStatus($referenceNo, 'failed', null);
return view('payment.failed', [
'message' => 'Payment failed. Please try again.',
'errorCode' => $transactionStatus
]);
}
}
private function updateOrderStatus($referenceNo, $status, $transactionId)
{
// Update your database with the transaction result
// Example: Order::where('reference_no', $referenceNo)->update([...]);
}
Example 3: E-Commerce Checkout Integration
Integrate Laravel EazyPay into a complete checkout flow:
public function checkout(Request $request)
{
// Validate cart and create order
$order = Order::create([
'user_id' => auth()->id(),
'total_amount' => $request->total,
'status' => 'pending',
'reference_no' => 'ORD_' . time() . '_' . auth()->id()
]);
// Store order items
foreach ($request->items as $item) {
$order->items()->create($item);
}
// Initiate payment
$eazypay = new Eazypay();
$optionalField = $order->user->name . '|' . $order->user->email . '|' . $order->user->phone . '|' . $order->id;
$paymentUrl = $eazypay->getPaymentUrl(
$order->total_amount,
$order->reference_no,
$optionalField
);
return redirect()->to($paymentUrl);
}
Example 4: Route Configuration
Add routes to your routes/web.php:
use App\Http\Controllers\PaymentController;
Route::middleware(['auth'])->group(function () {
Route::post('/payment/initiate', [PaymentController::class, 'initiatePayment'])
->name('payment.initiate');
Route::get('/payment/response', [PaymentController::class, 'paymentResponse'])
->name('payment.response');
});
Conclusion
Laravel EazyPay represents a significant advancement in payment gateway integration for Laravel developers, providing a robust, secure, and developer-friendly solution for implementing ICICI Bank’s EazyPay payment gateway. By abstracting the complexities of checksum generation, encryption, and response handling, the package allows developers to focus on building great user experiences rather than wrestling with payment integration details.
Get Started Today: Visit the GitHub repository to explore the code, contribute, or report issues. For more information about ICICI EazyPay services, visit the official ICICI EazyPay website.



