raziul / sslcommerz-laravel
SSLCommerz Laravel is a super easy package to integrate SSLCommerz on Laravel websites.
Requires
- php: ^8.2||^8.3||^8.4||^8.5
- guzzlehttp/guzzle: ^7.10
- illuminate/contracts: ^10.0||^11.0||^12.0||^13.0
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0||^8.6
- orchestra/testbench: ^11.0||^10.0||^9.0||^8.22
- pestphp/pest: ^2.36||^3.8||^4.0
- pestphp/pest-plugin-arch: ^2.7||^3.0||^4.0
- pestphp/pest-plugin-laravel: ^2.4||^3.2||^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
SSLCommerz Laravel Package
This package provides an elegant and convenient way to integrate the SSLCommerz payment gateway into your Laravel application. With features like fluent payment initiation, server-side transaction validation, refund processing, and MD5 hash verification, this package offers a clean API for developers to implement payments quickly and securely.
📑 Table of Contents
- Features
- Requirements
- Installation
- Configuration
- Quick Start
- Documentation
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
✨ Features
- 🚀 Great Developer Experience with a fluent, chainable API
- 💳 Seamless payment session creation via SSLCommerz Hosted Checkout
- 🔄 Automatic callback routing for Success, Failure, Cancel, and IPN
- 🛡️ Direct server-to-server transaction validation
- 💸 Full & partial refund support with refund status tracking
- 🔐 Response authenticity verification using MD5 digital signatures
- 🧪 Sandbox and Live production environments
- 💱 Multi-currency support (BDT, USD, EUR, GBP, etc.)
- 🎯 Payment gateway filtering (e.g. restrict to bKash, Nagad, Visa)
📋 Requirements
- PHP:
8.2or higher (8.2,8.3,8.4,8.5) - Laravel:
10.x,11.x,12.x,13.x - SSLCommerz Account: Sandbox or Live Merchant credentials
📦 Installation
You can install the package via Composer:
composer require raziul/sslcommerz-laravel
Laravel's package discovery will register the service provider and Sslcommerz facade automatically.
⚙️ Configuration
1. Publish Configuration
Publish the config/sslcommerz.php configuration file:
php artisan sslcommerz:install
2. Environment Variables
Add your credentials to .env:
SSLC_SANDBOX=true # Set to false for live production SSLC_STORE_ID=your_store_id SSLC_STORE_PASSWORD=your_store_password SSLC_STORE_CURRENCY=BDT
💡 Quick Start
1. Initiate a Payment
use Raziul\Sslcommerz\Facades\Sslcommerz; $response = Sslcommerz::setOrder($amount, $invoiceId, 'Order #' . $invoiceId) ->setCustomer($name, $email, $phone, $address) ->setShippingInfo(1, $address) ->makePayment(); if ($response->success()) { return redirect($response->gatewayPageURL()); }
2. Validate the Payment
use Raziul\Sslcommerz\Facades\Sslcommerz; $isValid = Sslcommerz::validatePayment($request->all(), $transactionId, $amount); if ($isValid) { // Payment is authentic and verified $order->update(['status' => 'completed']); }
📖 Documentation
- Getting Started (বাংলা)
- Basic Usage & Workflow (বাংলা)
- Validation & Security (বাংলা)
- Refunds (বাংলা)
- Advanced Configuration (বাংলা)
- API Reference (বাংলা)
- Complete Example (বাংলা)
- Testing & Troubleshooting (বাংলা)
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.