afzalsabbir/sslaracommerz
Composer 安装命令:
composer require afzalsabbir/sslaracommerz
包简介
A package for SSLCommerz Payment Gateway. Inspired by https://github.com/sslcommerz/SSLCommerz-Laravel
README 文档
README
A package for SSLCommerz Payment Gateway
Inspired by SSLCommerz
SSLCommerz Payment gateway library for Laravel framework. Official documentation is here.
Tags: Payment Gateway, SSLCommerz, IPN, Laravel, SSLaraCommerz
Requires: Laravel >= 5.6 and MySQL
License: MIT License
Install
composer require afzalsabbir/sslaracommerz
Migration
php artisan migrate
Instructions
Vendor Publish - Required
# Public Assets php artisan vendor:publish --provider="AfzalSabbir\SSLaraCommerz\SSLaraCommerzServiceProvider" --tag="public-assets"
Public Assets: To integrate popup checkout, use the below script before the end of body tag.
-
For Sandbox
<script> (function (window, document) { var loader = function () { var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0]; script.src = "https://sandbox.sslcommerz.com/embed.min.js?" + Math.random().toString(36).substring(7); tag.parentNode.insertBefore(script, tag); }; window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader); })(window, document); </script>
or, Publish the Public Assets and use the below
sandboxscript<script src="/assets/js/sandbox.js"></script>
-
For Live
<script> (function (window, document) { var loader = function () { var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0]; script.src = "https://seamless-epay.sslcommerz.com/embed.min.js?" + Math.random().toString(36).substring(7); tag.parentNode.insertBefore(script, tag); }; window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader); })(window, document); </script>
or, Publish the Public Assets and use the below
livescript<script src="/assets/js/live.js"></script>
# Routes and Controller php artisan vendor:publish --provider="AfzalSabbir\SSLaraCommerz\SSLaraCommerzServiceProvider" --tag="routes-controller"
Routes and Controller: To customize the routes and controller, use the below command.
- Add
$this->loadRoutesFrom(base_path('routes/sslcommerz.php'));inapp/Providers/RouteServiceProvider.phpnamespace App\Providers; // ... class RouteServiceProvider extends ServiceProvider { // ... public function boot() { // ... $this->loadRoutesFrom(base_path('routes/sslcommerz.php')); } // ... }
Vendor Publish - Optional
# Config php artisan vendor:publish --provider="AfzalSabbir\SSLaraCommerz\SSLaraCommerzServiceProvider" --tag="config" # Views ## Namespace: sslaracommerz php artisan vendor:publish --provider="AfzalSabbir\SSLaraCommerz\SSLaraCommerzServiceProvider" --tag="views" # Migrations php artisan vendor:publish --provider="AfzalSabbir\SSLaraCommerz\SSLaraCommerzServiceProvider" --tag="migrations"
Note: If you later encounter issues with session destroying after redirect, you can set
'same_site' => null,in yourconfig/session.phpfile.
-
Step 1: Add
STORE_IDandSTORE_PASSWORDvalues on your project's.envfile. You can register for a store at https://developer.sslcommerz.com/registration/ -
Step 2: Add the below routes into the
$exceptsarray ofVerifyCsrfTokenmiddleware.protected $except = [ '/pay-via-ajax', '/success','/cancel','/fail','/ipn' ];
Now, let's go to the main integration part.
-
Step 3: Use the below button where you want to show the "Pay Now" button:
<button class="your-button-class" id="sslczPayBtn" token="if you have any token validation" postdata="your javascript arrays or objects which requires in backend" order="If you already have the transaction generated for current order" endpoint="/pay-via-ajax"> Pay Now </button>
-
Step 4: For EasyCheckout (Popup) integration, you can update the
checkout_ajax.phpor use a different file according to your need. We have provided a basic sample page from where you can kickstart the payment gateway integration. -
Step 5: For Hosted Checkout integration, you can update the
checkout_hosted.phpor use a different file according to your need. We have provided a basic sample page from where you can kickstart the payment gateway integration. -
Step 6: For redirecting action from SSLCommerz Payment gateway, we have also provided sample
success.php,cancel.php,fail.phpfiles. You can update those files according to your need.
Original Documentation
For more clear concept read: SSLCommerz README.md
Testing
Run the tests with:
vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email afzalbd1@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
afzalsabbir/sslaracommerz 适用场景与选型建议
afzalsabbir/sslaracommerz 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 144 次下载、GitHub Stars 达 22, 最近一次更新时间为 2022 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sslcommerz」 「SSLCommerzBD」 「SSLaraCommerz」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 afzalsabbir/sslaracommerz 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 afzalsabbir/sslaracommerz 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 afzalsabbir/sslaracommerz 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
SSLCommerz Laravel is a super easy package to integrate SSLCommerz on Laravel websites.
Laravel library for SSLCommerz payment gateway
Laravel sslcommerz payment package
Laravel SSLCommerz is a super easy package to integrate SSLCommerz on Laravel websites.
Laravel library for SSLCommerz payment gateway
A production-ready Laravel package for SSLCommerz payment gateway — supports hosted & checkout modes, IPN with hash verification, order validation, refunds, transaction queries. Laravel 9–12, PHP 8.1–8.5.
统计信息
- 总下载量: 144
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-11