restoore/laravel-systempay
Composer 安装命令:
composer require restoore/laravel-systempay
包简介
Easily create a systempay payment form.
关键字:
README 文档
README
What is the point ?
The library provides an easy and fast systempay form creation. She helps to instanciate all required parameters and create the form to access to payment interface. To know required parameters, go to https://systempay.cyberpluspaiement.com/html/documentation.html
Installation
First you need to add the component to your composer.json
composer require restoore/laravel-systempay
Update your packages with composer update or install with composer install. Execute php artisan vendor:publish --provider="Restoore\Systempay\SystempayServiceProvider" command to copy systempay.php configuration file in your environment
After updating composer, add the ServiceProvider to the providers array in config/app.php
For Laravel >= 5.1
'providers' => [ ... Restoore\Systempay\SystempayServiceProvider::class, ]
For Laravel 5.0
'providers' => [ ... Restoore\Systempay\SystempayServiceProvider, ]
For Laravel >= 5.5
It's automatic, thanks to xmoroccan for this update
Configuration
By default, the package comes with an example configuration file : config/systempay.php
return [ 'YOUR_SITE_ID' => [ 'key' => 'YOUR_KEY', 'env' => 'PRODUCTION', 'params' => [ //Put here your generals payment call parameters 'vads_page_action' => 'PAYMENT', 'vads_action_mode' => 'INTERACTIVE', 'vads_payment_config' => 'SINGLE', 'vads_page_action' => 'PAYMENT', 'vads_version' => 'V2', 'vads_currency' => '978' ] ], //Systempay's url 'url' => 'https://paiement.systempay.fr/vads-payment/', ];
In this file, you have to put your site_id and your key. This two parameters are given by Systempay. As you can see, you can create a configuration array to several shops. In this array, you can also put generals parameters of your transaction.
Test environment
If you are running your app in a test environment, you can override key and env parameters using .env file
Use this following constants names : SYSTEMPAY_<SITE_ID>KEY and SYSTEMPAY<SITE_ID>_ENV
Create a payment form
Now we are finally ready to use the package! Here is a little example of code to explain how does it work
//create a Systempay object class with your site id in parameter. Note that it will automatically get your configuration in config/systempay.php $systempay = App::make('systempay', ['site_id' => '11111']); //add some parameters $systempay->set_amount(1500) ->set_trans_id(1112441) ->set_order_info2('New customer !'); //create the signature $systempay->set_signature(); //create html systempay call form $payment_form = $systempay->get_form('<button class="btn btn-lg btn-primary btn-payment" type="submit">Valider et payer</button>');
What you have to know about this code
- You can get and set all Systempay parameters using accessor
- All setters are chainables functions
- Signature will be automatically calculated and put to the parameters array. Don't use this function before giving all parameters.
- get_form function takes the form button you want to show in parameter. Don't forget to use {!! !!} for surrounding the variable in your view.
Other useful functions
add_product
Add a product to the order
Parameters
array $product , must have the following keys : 'label,amount,type,ref,qty
Exemples
$systempay = App::make('systempay', ['site_id' => '11111']); $systempay->add_product( [ 'label' => 'Concert Coldplay 2016', 'amount' => 235.00, 'type' => 'ENTERTAINMENT', 'ref' => 'COLD016', 'qty' => 3 ] );
Note : the amount of each products price must not be multiplied by 100
set_amount
Defines the total amount of the order. If you doesn't give the amount in parameter, it will be automaticly calculated by the sum of products you've got in your basket.
Parameters
[optional] int $amount, systempay format. ex : for a product with a price of 150€, give 15000
Exemples
$systempay = App::make('systempay', ['site_id' => '11111']); $systempay->add_product( [ 'label' => 'Concert Coldplay 2016', 'amount' => 235.00, 'type' => 'ENTERTAINMENT', 'ref' => 'COLD016', 'qty' => 3 ] ); $systempay->set_amount(); echo $systempay->get_amount(); //will display 705.00 (3*235.00)
get_amount
Get total amount of the order
Parameters
[optional] bool $decimal if true, you get a decimal otherwise you get standard systempay amount format (int). Default value is true.
Exemples
$systempay = App::make('systempay', ['site_id' => '11111']); $systempay->add_product( [ 'label' => 'Concert Coldplay 2016', 'amount' => 235.00, 'type' => 'ENTERTAINMENT', 'ref' => 'COLD016', 'qty' => 3 ] ); $systempay->set_amount(); echo $systempay->get_amount(); //will display 705.00 (3*235.00) echo $systempay->get_amount(false); //will display 70500 (3*235.00)
set_params
Method to do massive assignement of parameters
Parameters
array $params associative array of systempay parameters
Exemples
$systempay = App::make('systempay', ['site_id' => '11111']); $systempay->set_params( [ 'vads_page_action' => 'PAYMENT', 'vads_action_mode' => 'INTERACTIVE', 'vads_payment_config' => 'SINGLE', 'vads_page_action' => 'PAYMENT', 'vads_version' => 'V2', 'vads_trans_date' => gmdate('YmdHis'), 'vads_currency' => '978' ] );
restoore/laravel-systempay 适用场景与选型建议
restoore/laravel-systempay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.16k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「systempay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 restoore/laravel-systempay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 restoore/laravel-systempay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 restoore/laravel-systempay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Payum PayZen (Systempay, Scellius) gateway
SystemPay driver for the Omnipay payment processing library
Laravel component to generate a payment form for Banque Populaire Systempay
PHP Systempay PSP client
The library provides an easy and fast systempay webservice package. Web services are used to include one or several payment functions into an integrated CMS.
Lyra payments Webservices v5 PHP Client (SytemPay, Payzen, Sogecommerce, Crédit du Nord, ...)
统计信息
- 总下载量: 11.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-04