smronju/laravel-sslcommerz

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

Maintainers

Package info

github.com/smronju/laravel-sslcommerz

pkg:composer/smronju/laravel-sslcommerz

Fund package maintenance!

smronju

Statistics

Installs: 25

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-03-27 10:24 UTC

This package is auto-updated.

Last update: 2026-03-27 14:57:34 UTC


README

Laravel SSLCommerz Package

Laravel SSLCommerz

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

Integrate SSLCommerz into your Laravel application in minutes. This package provides a clean, fluent API to handle payments, validations, and refunds with zero hassle.

๐Ÿš€ Quick Start in 3 Steps

1. Install via Composer

composer require smronju/laravel-sslcommerz

2. Configure Your Environment

Add your credentials to your .env file:

SSLCOMMERZ_STORE_ID=your_id
SSLCOMMERZ_STORE_PASSWORD=your_password
SSLCOMMERZ_STORE_CURRENCY=BDT # Optional (default: BDT)
SSLCOMMERZ_SANDBOX=true # Set false for production (default: true)

โœจ How to get 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 https://developer.sslcommerz.com/registration/ 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 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.

3. Initialize & Publish (Optional)

This will publish the configuration file to config/sslcommerz.php:

php artisan laravel-sslcommerz:install

๐Ÿ’ก Simple Usage

๐Ÿ’ณ Initiate a Payment

The package uses a fluent interface to prepare and trigger the payment.

use Smronju\Sslcommerz\Facades\Sslcommerz;

$response = Sslcommerz::setOrder($amount, $invoiceId, $productName)
    ->setCustomer($name, $email, $phone)
    ->makePayment();

if ($response->success()) {
    return redirect($response->gatewayPageURL());
}

โœ… Validate Payment

Simply pass the request data and expected transaction details.

$isValid = Sslcommerz::validatePayment($request->all(), $transactionId, $amount);

if ($isValid) {
    // Save to database, update status, etc.
}

๐Ÿ›  Advanced Features

Handling Callbacks

Define your routes in routes/web.php:

Route::post('/sslcommerz/success', [SslcommerzController::class, 'success'])->name('sslcommerz.success');
Route::post('/sslcommerz/failure', [SslcommerzController::class, 'failure'])->name('sslcommerz.failure');

Refunds & Status Checks

// Request a refund
$refund = Sslcommerz::refundPayment($bankTranId, $amount, "Customer requested refund");

// Check refund status
$status = Sslcommerz::checkRefundStatus($refundRefId);

๐Ÿ”ฅ Features at a Glance

  • โœ… PHP 8.2+ & Laravel 12-13 support.
  • ๐Ÿ›  Fluent API: Ready-to-use methods for customer info, shipping info, etc.
  • ๐Ÿ”’ Secure: In-built hash verification and data validation.
  • ๐Ÿ“ฆ Zero Config: Works out of the box with sensible defaults.
  • ๐Ÿงช Sandbox Ready: Easy toggle between sandbox and live environments.

๐Ÿ“– Documentation

For detailed guides on dynamic parameters, IPN handling, and advanced configurations, visit the Documentation Wiki.

Credits

License

The MIT License (MIT). Please see License File for more information.