shipu/php-sslwireless-payment
Composer 安装命令:
composer require shipu/php-sslwireless-payment
包简介
PHP client for SSL Wireless Payment API
README 文档
README
php-sslwireless-payment is a PHP client for SSL Wirless Payment Gateway API. This package is also support Laravel.
Installation
Go to terminal and run this command
composer require shipu/php-sslwireless-payment
Wait for few minutes. Composer will automatically install this package for your project.
For Laravel
Below Laravel 5.5 open config/app and add this line in providers section
Shipu\SslWPayment\SslWPaymentServiceProvider::class,
For Facade support you have add this line in aliases section.
'Payment' => Shipu\SslWPayment\Facades\Payment::class,
Then run this command
php artisan vendor:publish --provider="Shipu\SslWPayment\SslWPaymentServiceProvider"
Configuration
This package is required three configurations.
- store_id = your store id in SSL-Wirless Payment Gateway.
- store_password = your store password in SSL-Wirless Payment Gateway
- sandbox =
truefor sandbox andfalsefor live - redirect_url = your application redirect url after
success,failandcancel.
php-sslwireless-payment is take an array as config file. Lets services
use Shipu\SslWPayment\Payment; $config = [ 'store_id' => 'Your store id', 'store_password' => 'Your store password', 'sandbox' => true, 'redirect_url' => [ 'fail' => [ 'route' => 'payment.failed' ], 'success' => [ 'route' => 'payment.success' ], 'cancel' => [ 'route' => 'payment.cancel' ] ] ]; $payment = new Payment($config);
For Laravel
This package is also support Laravel. For laravel you have to configure it as laravel style.
Go to app\sslwpayment.php and configure it with your credentials.
return [ 'store_id' => 'Your store id', 'store_password' => 'Your store password', 'sandbox' => true, 'redirect_url' => [ 'fail' => [ 'route' => 'payment.failed' ], 'success' => [ 'route' => 'payment.success' ], 'cancel' => [ 'route' => 'payment.cancel' ] ] ];
Usages
- Mandatory input field name
- tran_id
- cus_name
- cus_email
- cus_phone
Getting Payment Post Url
In PHP:
use \Shipu\SslWPayment\Payment; ... $payment = new Payment($config); return $payment->paymentUrl();
In Laravel:
use \Shipu\SslWPayment\Payment; ... $payment = new Payment(config('sslwpayment')); return $payment->paymentUrl();
Getting Hidden Input Field
use \Shipu\SslWPayment\Payment; ... $payment = new Payment(config('sslwpayment')); return $payment->customer([ 'cus_name' => 'Shipu Ahamed', // Customer name 'cus_email' => 'shipuahamed01@gmail.com', // Customer email 'cus_phone' => '01616022669' // Customer Phone ])->transactionId('21005455540')->amount(3500)->hiddenValue();
Where Transaction id is random value. you can generate by yourself or follow bellow steps:
use \Shipu\SslWPayment\Payment; ... $payment = new Payment(config('sslwpayment')); return $payment->customer([ 'cus_name' => 'Shipu Ahamed', // Customer name 'cus_phone' => '01616022669', // Customer Phone 'cus_email' => 'shipuahamed01@gmail.com' // Customer email ])->transactionId()->amount(3500)->hiddenValue(); or return $payment->customer([ 'cus_name' => 'Shipu Ahamed', // Customer name 'cus_phone' => '01616022669', // Customer Phone 'cus_email' => 'shipuahamed01@gmail.com' // Customer email ])->amount(3500)->hiddenValue();
Generate Transaction Id
use \Shipu\SslWPayment\Payment; ... $payment = new Payment(config('sslwpayment')); return $payment->generateTransaction();
Checking Valid Response
use \Shipu\SslWPayment\Payment; ... $payment = new Payment(config('sslwpayment')); return $payment->valid($request);
Checking valid response with amount:
use \Shipu\SslWPayment\Payment; ... $payment = new Payment(config('sslwpayment')); return $payment->valid($request, '3500');
Checking valid response with amount and transaction id:
use \Shipu\SslWPayment\Payment; ... $payment = new Payment(config('sslwpayment')); return $payment->valid($request, '3500', '21005455540');
Where $request will appear after post response.
In Blade
Getting Payment Post Url
{{ ssl_wireless_payment_url() }}
Getting Hidden Input Field
{!!
ssl_wireless_hidden_input([
'tran_id' => '21005455540', // random number
'cus_name' => 'Shipu Ahamed', // Customer name
'cus_email' => 'shipuahamed01@gmail.com', // Customer email
'cus_phone' => '01616022669' // Customer Phone
], 3500)
!!}
Complete Post Button View
{!!
ssl_wireless_post_button([
'tran_id' => '21005455540', // random number
'cus_name' => 'Shipu Ahamed', // Customer name
'cus_email' => 'shipuahamed01@gmail.com', // Customer email
'cus_phone' => '01616022669' // Customer Phone
], 2000, '<i class="fa fa-money"></i>', 'btn btn-sm btn-success')
!!}
Example
Route
Route::post('payment/success', 'YourMakePaymentsController@paymentSuccess')->name('payment.success'); Route::post('payment/failed', 'YourMakePaymentsController@paymentFailed')->name('payment.failed'); Route::post('payment/cancel', 'YourMakePaymentsController@paymentCancel')->name('payment.cancel');
or
Route::post('payment/success', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.success'); Route::post('payment/failed', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.failed'); Route::post('payment/cancel', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.cancel');
Controller Method
use Shipu\SslWPayment\Facades\Payment; ... public function paymentSuccessOrFailed(Request $request) { if($request->get('status') == 'CANCELLED') { return redirect()->back(); } $transactionId = $request->get('tran_id'); $valid = Payment::valid($request, 3500, $transactionId); if($valid) { // Successfully Paid. } else { // Something went wrong. } return redirect()->back(); }
To Disable CSRF token
Open app/Http/Middleware/VerifyCsrfToken.php and adding :
protected $except = [ ... 'payment/*', ... ];
Credits
Special Thanks to Tawsif ul Karim.
Support on Beerpay
Hey dude! Help me out for a couple of 🍻!
shipu/php-sslwireless-payment 适用场景与选型建议
shipu/php-sslwireless-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 142 次下载、GitHub Stars 达 46, 最近一次更新时间为 2017 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「sms」 「SSL Wireless」 「php-ssl-payment」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shipu/php-sslwireless-payment 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shipu/php-sslwireless-payment 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shipu/php-sslwireless-payment 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
yii2-sms expand
Alfabank REST API integration
A fork of simplesoftwareio/simple-sms with Verimor driver.
统计信息
- 总下载量: 142
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 46
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-13