PHPackages                             hasinhayder/sslcommerz-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. hasinhayder/sslcommerz-laravel

ActiveLibrary[Payment Processing](/categories/payments)

hasinhayder/sslcommerz-laravel
==============================

SSLCommerz Laravel is a super easy package to integrate SSLCommerz on Laravel websites.

v1.1.1(1mo ago)30MITPHPPHP ^8.2||^8.3||^8.4

Since Mar 20Pushed 1mo agoCompare

[ Source](https://github.com/hasinhayder/sslcommerz-laravel)[ Packagist](https://packagist.org/packages/hasinhayder/sslcommerz-laravel)[ Docs](https://github.com/hasinhayder/sslcommerz-laravel)[ RSS](/packages/hasinhayder-sslcommerz-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (3)Used By (0)

Sslcommerz Laravel Package
==========================

[](#sslcommerz-laravel-package)

This package provides an easy and convenient way to integrate **SSLCommerz** payment gateway into your **Laravel** application. With features like payment processing, payment validation, refunds, and hash verification, this package offers a simple API for developers to quickly implement payment functionality.

🔥 Features
----------

[](#-features)

- Great Developer Experience
- Initiate payments via SSLCommerz
- Set callback URLs for success, failure, cancellation and IPN
- Validate payment transactions
- Refund payments and check refund status
- Verify hash from SSLCommerz responses
- Sandbox and live environment support

Requirements
------------

[](#requirements)

- PHP 8.2 or above
- Laravel 10.0 through 13.x
- SSLCommerz Credentials

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require hasinhayder/sslcommerz-laravel
```

Once installed, the service provider will be registered automatically.

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env` file:

```
SSLC_SANDBOX=true # or false for live
SSLC_STORE_ID=your_store_id
SSLC_STORE_PASSWORD=your_store_password
SSLC_STORE_CURRENCY='BDT'

# SSLCommerz route names (optional)
SSLC_ROUTE_SUCCESS='sslc.success'
SSLC_ROUTE_FAILURE='sslc.failure'
SSLC_ROUTE_CANCEL='sslc.cancel'
SSLC_ROUTE_IPN='sslc.ipn'
```

Optionally, You can publish the configuration file using the following command:

```
php artisan sslcommerz-laravel:install
```

This will publish the `sslcommerz.php` file to your `config` directory.

### ✨ Getting Sandbox Credentials

[](#-getting-sandbox-credentials)

SSLCommerz credentials are required to use this package. You can get sandbox credentials by following these steps:

1. **Create Sandbox Account**: Visit the  page to create an account.
2. **Obtain Credentials:** After registration, you will receive your **Store ID** and **Store Password** via email or from the SSLCommerz dashboard.
3. **Set Up in .env:** Copy these credentials and paste them into your `.env` file as shown in the [Configuration](#configuration) step.

Important

Sandbox credentials are for testing purposes only. You should replace them with your live credentials and change SANDBOX=false before deploying to production.

💡 Usage
-------

[](#-usage)

### 1. **Defining Callback Routes**

[](#1-defining-callback-routes)

To handle different stages of the payment lifecycle, define your callback routes for success, failure, cancellation, and IPN (Instant Payment Notification):

```
Route::controller(SslcommerzController::class)
    ->prefix('sslcommerz') // prefix to avoid conflicts
    ->name('sslc.')
    ->group(function () {
        Route::post('success', 'success')->name('success');
        Route::post('failure', 'failure')->name('failure');
        Route::post('cancel', 'cancel')->name('cancel');
        Route::post('ipn', 'ipn')->name('ipn');
    });
```

We defined the `sslc.success`, `sslc.failure`, `sslc.cancel`, and `sslc.ipn` routes according to the configured route names. Now create the `SslcommerzController` controller and implement the `success`, `failure`, `cancel`, and `ipn` methods as required.

### 2. **Initiating a Payment**

[](#2-initiating-a-payment)

Initiating a payment has never been easier. For example, you can use the following code:

```
use \HasinHayder\Sslcommerz\Facades\Sslcommerz;

$response = Sslcommerz::setOrder($amount, $invoiceId, $productName)
    ->setCustomer($customerName, $customerEmail, $customerPhone)
    ->setShippingInfo($itemsQuantity, $address)
    ->makePayment();

if ($response->success()) {
    // payment initiated, redirect to payment page
    return redirect($response->gatewayPageURL());
} else {
    // Handle payment failure
}
```

### 3. **Validating a Payment**

[](#3-validating-a-payment)

To validate a payment after a successful transaction:

```
use \HasinHayder\Sslcommerz\Facades\Sslcommerz;

$isValid = Sslcommerz::validatePayment($requestData, $transactionId, $amount);

if ($isValid) {
    // Payment is valid
} else {
    // Payment is invalid
}
```

### 4. **Refunds**

[](#4-refunds)

If you need to refund a payment, you can do so easily:

```
$refundResponse = Sslcommerz::refundPayment($bankTransactionId, $amount, $reason);
```

You can also check the refund status:

```
$refundStatus = Sslcommerz::checkRefundStatus($refundRefId);
```

### 5. **Hash Verification**

[](#5-hash-verification)

To verify the authenticity of the response from SSLCommerz, use the `verifyHash` method:

```
if (Sslcommerz::verifyHash($request->all())) {
    // Hash is valid
}
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Hasin Hayder](https://github.com/hasinhayder)
- [Raziul Islam](https://github.com/iRaziul)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

2

Last Release

50d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9404e4113aa88c4cd96934e7e85b122bddcd7d512d39bf46aecfde610f273060?d=identicon)[HasinHayder](/maintainers/HasinHayder)

---

Top Contributors

[![iRaziul](https://avatars.githubusercontent.com/u/51883557?v=4)](https://github.com/iRaziul "iRaziul (15 commits)")[![hasinhayder](https://avatars.githubusercontent.com/u/490779?v=4)](https://github.com/hasinhayder "hasinhayder (14 commits)")[![HazzazBinFaiz](https://avatars.githubusercontent.com/u/29161993?v=4)](https://github.com/HazzazBinFaiz "HazzazBinFaiz (1 commits)")[![masroore](https://avatars.githubusercontent.com/u/200963?v=4)](https://github.com/masroore "masroore (1 commits)")[![MHJanny](https://avatars.githubusercontent.com/u/26045285?v=4)](https://github.com/MHJanny "MHJanny (1 commits)")[![sallu-50](https://avatars.githubusercontent.com/u/98665249?v=4)](https://github.com/sallu-50 "sallu-50 (1 commits)")

---

Tags

laravel11laravel12laravel13sslcommerzlaravelsslcommerzSSLCommerz laravelsslcommerz-payment-gatewaylaravel-sslcommerz

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/hasinhayder-sslcommerz-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/hasinhayder-sslcommerz-laravel/health.svg)](https://phpackages.com/packages/hasinhayder-sslcommerz-laravel)
```

###  Alternatives

[raziul/sslcommerz-laravel

SSLCommerz Laravel is a super easy package to integrate SSLCommerz on Laravel websites.

691.4k1](/packages/raziul-sslcommerz-laravel)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

7812.3k](/packages/danestves-laravel-polar)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[creagia/laravel-redsys

Laravel Redsys Payments Gateway

2013.6k](/packages/creagia-laravel-redsys)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
