sam-asif/sslcommerz
Composer 安装命令:
composer require sam-asif/sslcommerz
包简介
SSLCOMMERZ is the largest payment gateway aggregator in Banglades.
README 文档
README
SSLCommerz Payment gateway library for Laravel framework. Official documentation is here.
install
composer require sam-asif/sslcommerz
Provider
You need to update your application configuration in order to register the package so it can be loaded by Laravel, just update your config/app.php file adding the following code at the end of your 'providers' section:
config/app.php
<?php return [ // ... 'providers' => [ SamAsif\Sslcommerz\SSLCommerzServiceProvider::class, // ... ], // ... ];
publish
php artisan vendor:publish
This command will create a sslcommerz.php file inside the config directory. Configure your parameters in your .env file
If your request value contain following key
total_amount
currency
tran_id
cus_name
cus_email
cus_add1
cus_add2
cus_city
cus_state
cus_postcode
cus_country
cus_phone
cus_fax
ship_name
ship_add1
ship_add2
ship_city
ship_state
ship_postcode
ship_phone
ship_country
shipping_method
product_name
product_category
product_profile
value_a
value_b
value_c
value_d
Then just call the controller method.
<?php use SamAsif\Sslcommerz\Http\Controllers\SamSSL; class OrderController extends Controller { public function Order(Request $request) { // ....... $sslc = new SamSSL(); $payment_options = $sslc->index($request, 'hosted'); if (!is_array($payment_options)) { print_r($payment_options); $payment_options = array(); } } }
If your request value dostn't contain those key, then define an array with those key and call the controller function.
<?php use SamAsif\Sslcommerz\Http\Controllers\SamSSL; class OrderController extends Controller { public function Order(Request $request) { $post_data = array(); $post_data['total_amount'] = '10'; # You cant not pay less than 10 $post_data['currency'] = "BDT"; $post_data['tran_id'] = uniqid(); // tran_id must be unique // ....... // Initialize SSlcommerz gateway $sslc = new SamSSL(); $payment_options = $sslc->index($post_data, 'hosted'); if (!is_array($payment_options)) { print_r($payment_options); $payment_options = array(); } } // For received return value public function return(Request $request){ return $request->all(); } }
Web Route
Route::post('/sslcommerz/return', 'OrderController::class@return')->name('sslcommerz.return');
This route for the received the return value from SSLCommerz gateway.
sam-asif/sslcommerz 适用场景与选型建议
sam-asif/sslcommerz 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 10 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sam-asif/sslcommerz 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sam-asif/sslcommerz 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-28