faysal0x1/lara-payment
Composer 安装命令:
composer require faysal0x1/lara-payment
包简介
A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless
关键字:
README 文档
README
The lara-payment package provides a convenient way to handle payments through multiple payment gateways in a Laravel 8, 9 and 10 application.
The package currently supports multiple gateways such as Paystack, Flutterwave and Stripe.
The package offers an easy to use interface that abstracts the complexities of integrating with these payment gateways.
It also provides a way to handle webhooks from the payment gateways.
Documentation
A comprehensive documentation is available to help you get started with the package here
Testing
php artisan test
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.
Laravel SSLCommerz Payment Gateway Integration
A Laravel package for integrating SSLCommerz payment gateway into your Laravel application. This package provides a simple and flexible way to handle payments through SSLCommerz in your Laravel projects.
Features
- Easy checkout and hosted checkout options
- AJAX payment support
- IPN (Instant Payment Notification) handling
- Success, fail, and cancel URL handling
- Order validation
- Sandbox mode support
- Multiple payment methods support
- EMI payment support
- Customizable payment forms
- Comprehensive error handling
Requirements
- PHP >= 7.4
- Laravel >= 8.0
- SSLCommerz merchant account
Installation
- Install the package via Composer:
composer require faysal0x1/lara-payment
- Publish the configuration file:
php artisan vendor:publish --provider="Faysal0x1\LaraPayment\SslcommerzLaravelServiceProvider" --tag="config"
- Publish the controller:
php artisan vendor:publish --provider="Faysal0x1\LaraPayment\SslcommerzLaravelServiceProvider" --tag="controllers"
- Publish the views:
php artisan vendor:publish --provider="Faysal0x1\LaraPayment\SslcommerzLaravelServiceProvider" --tag="views"
- Publish the migrations:
php artisan vendor:publish --provider="Faysal0x1\LaraPayment\SslcommerzLaravelServiceProvider" --tag="migrations"
- Run the migrations:
php artisan migrate
Configuration
Add the following environment variables to your .env file:
SSLCOMMERZ_SANDBOX=true SSLCOMMERZ_STORE_ID=your_store_id SSLCOMMERZ__STORE_PASSWORD=your_store_password
The configuration file (config/sslcommerz.php) contains the following options:
return [ 'sandbox' => env("SSLCOMMERZ_SANDBOX", false), 'middleware' => 'web', 'store_id' => env("SSLCOMMERZ_STORE_ID"), 'store_password' => env("SSLCOMMERZ__STORE_PASSWORD"), 'success_url' => '/sslcommerz/success', 'failed_url' => '/sslcommerz/fail', 'cancel_url' => '/sslcommerz/cancel', 'ipn_url' => '/sslcommerz/ipn', 'return_response' => 'html', // html or json ];
Usage
Basic Payment Integration
- Using the Facade:
use Faysal0x1\LaraPayment\Facade\SSLCommerzPayment; // Make payment $data = [ 'total_amount' => 100, 'currency' => 'BDT', 'tran_id' => uniqid(), 'product_category' => 'Test Category' ]; $customer = [ 'name' => 'John Doe', 'email' => 'john@example.com', 'address_1' => 'Dhaka', 'phone' => '8801XXXXXXXXX', 'country' => 'Bangladesh' ]; $shipment = [ 'shipping_method' => 'Yes', 'ship_name' => 'John Doe', 'ship_add1' => 'Dhaka', 'ship_city' => 'Dhaka', 'ship_country' => 'Bangladesh' ]; $response = SSLCommerzPayment::makePayment($data) ->setCustomerInfo($customer) ->setShipmentInfo($shipment);
- Using the Controller:
Visit /example1 for AJAX payment or /example2 for hosted payment.
Available Routes
Route::get('/example1', [SslCommerzPaymentController::class, 'exampleEasyCheckout']); Route::get('/example2', [SslCommerzPaymentController::class, 'exampleHostedCheckout']); Route::post('/pay', [SslCommerzPaymentController::class, 'index']); Route::post('/pay-via-ajax', [SslCommerzPaymentController::class, 'payViaAjax']); Route::post('/success', [SslCommerzPaymentController::class, 'success']); Route::post('/fail', [SslCommerzPaymentController::class, 'fail']); Route::post('/cancel', [SslCommerzPaymentController::class, 'cancel']); Route::post('/ipn', [SslCommerzPaymentController::class, 'ipn']);
Advanced Features
- EMI Payment Support:
$sslc = new SslCommerzNotification(); $sslc->enableEMI(3, 12, false); // 3 months installment, max 12 months, not restricted to EMI only
- Airline Ticket Profile:
$airlineInfo = [ 'hours_till_departure' => '24', 'flight_type' => 'domestic', 'pnr' => 'ABC123', 'journey_from_to' => 'Dhaka to Chittagong' ]; $sslc->setAirlineTicketProfile($airlineInfo);
- Travel Vertical Profile:
$travelInfo = [ 'hotel_name' => 'Grand Hotel', 'length_of_stay' => 3, 'check_in_time' => '14:00', 'hotel_city' => 'Dhaka' ]; $sslc->setTravelVerticalProfile($travelInfo);
- Telecom Vertical Profile:
$telecomInfo = [ 'product_type' => 'prepaid', 'topup_number' => '8801XXXXXXXXX', 'country_topup' => 'Bangladesh' ]; $sslc->setTelecomVerticleProfile($telecomInfo);
Response Handling
- Success Response:
return SSLCommerzPayment::returnSuccess($transId, "Transaction is successfully Completed", '/');
- Failure Response:
return SSLCommerzPayment::returnFail($transId, "Transaction is Failed", '/');
Database Structure
The package creates an orders table with the following structure:
Schema::create('orders', function (Blueprint $table) { $table->id(); $table->string('name', 191)->nullable(); $table->string('email', 191)->nullable(); $table->string('phone', 60)->nullable(); $table->double('amount')->default(0); $table->text('address')->nullable(); $table->string('status', 20)->default('Pending'); $table->string('transaction_id', 191); $table->string('currency', 20)->nullable()->default('BDT'); $table->timestamps(); });
Security Considerations
- Always use environment variables for sensitive data
- Enable SSL on your production environment
- Validate all incoming data
- Use proper error handling
- Keep your store credentials secure
Testing
- Set
SSLCOMMERZ_SANDBOX=truein your.envfile for testing - Use test credentials provided by SSLCommerz
- Test all payment scenarios (success, fail, cancel)
- Verify IPN handling
- Test with different currencies and amounts
Support
For any issues or questions, please create an issue in the GitHub repository.
License
This package is open-sourced software licensed under the MIT license.
faysal0x1/lara-payment 适用场景与选型建议
faysal0x1/lara-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 05 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payments」 「stripe」 「laravel」 「payment gateway」 「laravel package」 「paystack」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 faysal0x1/lara-payment 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 faysal0x1/lara-payment 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 faysal0x1/lara-payment 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Flexible payment integration for Laravel, lunarphp, supporting multiple payment providers.
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
Alfabank REST API integration
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-20