Download the PHP package sslcommerz/laravel without Composer
On this page you can find all versions of the php package sslcommerz/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sslcommerz/laravel
More information about sslcommerz/laravel
Files in sslcommerz/laravel
Package laravel
Short Description Production-ready Laravel package for SSLCOMMERZ payment gateway integration (API v4)
License MIT
Homepage https://github.com/sslcommerz/SSLCommerz-Laravel
Informations about the package laravel
SSLCOMMERZ Laravel Package
Table of Contents
- Installation
- Configuration
- Quick Start
- Payment Flow
- Usage
- Initiate Payment
- Recurring Payments (Easycheckout)
- Validate Transaction
- Refund
- Query Transaction
- Callback Handling
- Redirect URLs After Payment
- Events
- Hash Verification
- Custom Controllers
- Testing
- API Reference
- Security
- Troubleshooting
Installation
Publish Configuration
Publish Routes (Optional)
Publish Everything
Configuration
Add these variables to your .env file:
Note:
SSLCOMMERZ_SALT_KEYis required for recurring payments (Easycheckout).
Quick Start
Sandbox Test Credentials
Register at https://developer.sslcommerz.com/registration/ to get your sandbox credentials.
Test Card Numbers:
| Card Type | Number | Expiry | CVV |
|---|---|---|---|
| VISA | 4111111111111111 | 12/36 | 111 |
| Mastercard | 5111111111111111 | 12/36 | 111 |
| Amex | 371111111111111 | 12/36 | 111 |
Mobile OTP: 111111 or 123456
Custom Controllers
You can easily override the default callback behavior.
-
Publish the Controller Stub:
-
Update Configuration: In your
config/sslcommerz.php, update thecontrolleroption to point to your new controller: - Customize Logic:
Edit
app/Http/Controllers/SslcommerzCallbackController.phpto suit your needs.
Note: If you want to customize the URLs, you can also publish the routes:
php artisan vendor:publish --tag=sslcommerz-routes
Payment Flow
Usage
Initiate Payment
Specialized Parameters (API v4)
| Category | Parameters |
|---|---|
| Airline | pnr, hours_till_departure, flight_type, journey_from_to, third_party_booking |
| Travel | hotel_name, length_of_stay, check_in_time, hotel_city |
| Telecom | product_type, topup_number, country_topup |
| Logistics | logistic_pickup_id, logistic_delivery_type |
Recurring Payments (Easycheckout)
SSLCOMMERZ supports recurring payments via a schedule parameter.
1. Configure SALT Key:
Add SSLCOMMERZ_SALT_KEY to your .env file. This key is provided by the SSLCOMMERZ team.
2. Initiate Recurring Payment:
3. Manage Subscriptions:
Validate Transaction
Refund
Query Transaction
Logging
By default, the package logs all gateway interactions using Laravel's default log configuration. You can disable logging by setting SSLCOMMERZ_LOG_ENABLED=false.
Callback Handling
The package registers these routes automatically:
| Route | Name | Purpose |
|---|---|---|
POST /ssl/success |
sslcommerz.success |
Successful payment |
POST /ssl/fail |
sslcommerz.fail |
Failed payment |
POST /ssl/cancel |
sslcommerz.cancel |
Cancelled payment |
POST /ssl/ipn |
sslcommerz.ipn |
Instant Payment Notification |
All routes exclude CSRF verification since SSLCOMMERZ sends POST requests.
By default, the prefix is ssl. You can change it via sslcommerz.routes.prefix in config/sslcommerz.php, or publish routes to customize paths.
Redirect URLs After Payment
Define your own routes and views to show the payment result to the user:
Events
Listen to these events in your EventServiceProvider:
Persistence (Handling Orders)
Since this package is database-agnostic, you should handle transaction persistence in your own application using listeners.
Example Listener:
Hash Verification
The package automatically verifies hash signatures on IPN callbacks. You can also verify manually:
Or use the middleware on your own routes:
Testing
Run Package Tests
Mock in Your Application Tests
API Reference
SSLCOMMERZ::initiate(PaymentRequestDTO|array $request): PaymentResponseDTO
Creates a payment session. If an array is passed, it is automatically converted to a DTO with sensible defaults.
SSLCOMMERZ::validate(string $valId): ValidationResponseDTO
Validates a transaction using the validation ID from callback/IPN.
SSLCOMMERZ::refund(RefundRequestDTO|array $request): RefundResponseDTO
Initiates a refund for a previously successful transaction.
SSLCOMMERZ::queryTransaction(string $tranId): TransactionQueryDTO
Queries all transactions associated with a merchant transaction ID.
SSLCOMMERZ::queryBySession(string $sessionKey): ValidationResponseDTO
Queries transaction status by SSLCOMMERZ session key.
SSLCOMMERZ::queryRefundStatus(string $refundRefId): RefundResponseDTO
Checks the current status of a refund request.
SSLCOMMERZ::verifyHash(array $data): bool
Verifies the MD5 hash signature of callback data.
Security
This package implements multiple layers of security:
- Hash Verification: All IPN callbacks are verified using SSLCOMMERZ's MD5 signature algorithm
- API Validation: Every successful payment is validated server-side via the Order Validation API
- CSRF Exemption: Only callback routes from SSLCOMMERZ are CSRF-exempt
- Logging: All gateway interactions are logged for audit trails
- Environment Isolation: Separate endpoints for sandbox and production
Best Practices
- Always validate transactions via the API, never trust callback data alone
- Monitor
risk_levelin validation responses (0 = Safe, 1 = Risky) - Use
value_athroughvalue_dto pass your own references - Set up IPN as the primary notification method (works even if user closes browser)
- Register your production IP at SSLCOMMERZ for refund API access
Troubleshooting
| Issue | Solution |
|---|---|
| "Invalid Store ID" | Check SSLCOMMERZ_STORE_ID in .env |
| CSRF token mismatch | Callback routes already exclude CSRF — check if you overrode routes |
| IPN not received | Ensure your server is reachable from internet on port 80/443 |
| Hash verification fails | Verify SSLCOMMERZ_STORE_PASSWORD matches your SSLCOMMERZ dashboard |
| Connection timeout | Whitelist SSLCOMMERZ IPs: 103.26.139.87 (sandbox), 103.26.139.81 (live) |
License
MIT License. See LICENSE for details.
All versions of laravel with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/events Version ^10.0|^11.0|^12.0|^13.0
illuminate/log Version ^10.0|^11.0|^12.0|^13.0