PHPackages                             raziul/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. raziul/sslcommerz-laravel

ActiveLibrary

raziul/sslcommerz-laravel
=========================

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

v1.0.2(1y ago)691.4k—8%271MITPHPPHP ^8.2||^8.3||^8.4CI passing

Since Sep 2Pushed 1mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (8)Versions (4)Used By (1)

[![Sslcommerz Laravel Package](/art/sslcommerz laravel.png)](https://github.com/iRaziul/sslcommerz-laravel)Sslcommerz Laravel Package
==========================

[](#sslcommerz-laravel-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a4d0eb370b195b329adec797d6532868212bc198f23e772288dffe65d31ec7a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72617a69756c2f73736c636f6d6d65727a2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/raziul/sslcommerz-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/17272be6691b63ea810a33d3bdbb8caffdf91210f750d01014a4d6aab0962648/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6952617a69756c2f73736c636f6d6d65727a2d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/iRaziul/sslcommerz-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/887dfdb9c76bdac728f2c3cf151cd8028936d50fb03d54142c29f07aa899d57f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72617a69756c2f73736c636f6d6d65727a2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/raziul/sslcommerz-laravel)[![License](https://camo.githubusercontent.com/b55b6463ec5f81f69a0dd6689bf4452adaa522588593e1d4a8ba3f8903b8a0d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72617a69756c2f73736c636f6d6d65727a2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/raziul/sslcommerz-laravel)

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 raziul/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 \Raziul\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
}
```

The `makePayment` method returns an instance of `Raziul\Sslcommerz\Data\PaymentResponse` class. Check the [available methods](https://github.com/iRaziul/sslcommerz-laravel/wiki/PaymentResponse) for more details.

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

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

To validate a payment after a successful transaction:

```
use \Raziul\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
}
```

📖 Documentation
---------------

[](#-documentation)

You can find detailed documentation, guides and examples on the [Wiki](https://github.com/iraziul/sslcommerz-laravel/wiki).

Changelog
---------

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [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

49

—

FairBetter than 95% of packages

Maintenance71

Regular maintenance activity

Popularity36

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

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 ~88 days

Total

3

Last Release

440d ago

PHP version history (2 changes)v1PHP ^8.2

v1.0.2PHP ^8.2||^8.3||^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/c371b774feadb3bfc182f9309ab6aeac6789b993ac63a213fe3aca070f95100d?d=identicon)[Raziul](/maintainers/Raziul)

---

Top Contributors

[![iRaziul](https://avatars.githubusercontent.com/u/51883557?v=4)](https://github.com/iRaziul "iRaziul (24 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

sslcommerzsslcommerz-laravelsslcommerz-payment-gatewaysslcommerz-payment-gateway-integrationlaravelsslcommerzSSLCommerz laravelsslcommerz-payment-gatewaylaravel-sslcommerz

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[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)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[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)

PHPackages © 2026

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