matthv/laravel-atos-sips-gateway
Composer 安装命令:
composer require matthv/laravel-atos-sips-gateway
包简介
Laravel Atos SIPS
README 文档
README
This package makes easily integration with the Atos SIPS payment system, which is widely used by the french banks under different names: Mercanet, E-Transactions, Citelis, Sogenactif etc.
Be aware this package only supports the version 2 of Atos SIPS.
Atos SIPS Official Documentation
Installation
1. composer
composer require matthv/laravel-atos-sips-gateway
2. publish
php artisan vendor:publish --provider="Matthv\AtosSipsGateway\Providers\AtosSipsServiceProvider"
3. configuration
Most of the values come from the Atos dashboard. You should put the following variables into your .env file :
- ATOS_TEST :
trueto use test environment. Defaults to true. provided by Atos dashboard - ATOS_MERCHANT_ID : merchant id.
- ATOS_SECRET_KEY : secret key.
- ATOS_KEY_VERSION : key version.
- ATOS_INTERFACE_VERSION : interface version.
- ATOS_PRODUCTION_URL : bank production url. Defaults to
https://payment-webinit.mercanet.bnpparibas.net/paymentInit. - ATOS_TEST_URL : bank test url. Defaults to
https://payment-webinit-mercanet.test.sips-atos.com/paymentInit.
You can see all configuration options in config/atos.php.
Example using Mercanet BNP Paribas :
ATOS_TEST=true
ATOS_MERCHANT_ID=211000021310001
ATOS_SECRET_KEY=S9i8qClCnb2CZU3y3Vn0toIOgz3z_aBi79akR30vM9o
ATOS_KEY_VERSION=1
ATOS_INTERFACE_VERSION=HP_2.20
Documentation : First-step - Dashboard-info
Usage
1. Prepare the form payment
To make a basic payment, you will need at least 2 information :
- paymentNumber is used to identify individual transactions. This corresponds to Atos
transactionReference. - The amount (integer formatted in cents). example 10.50 € => 1050. The default currency is Euro.
This code should be run in a controller. It will return a view which will automatically redirect the customer to the bank website.
return app()->make(AtosSipsAuthorization::class) ->setPaymentNumber('AABBAA'.rand(1000,9999)) ->setAmount(1000) ->paymentView();
You can add Atos SIPS custom fields with the setCustomParameter method.
return app()->make(AtosSipsAuthorization::class) ->setPaymentNumber('AABBAA'.rand(1000,9999)) ->setCustomParameters( [ 'customerEmail' => 'j.doe@customer-email.com', 'customerId' => 123, 'orderId' => 456, ] ) ->setAmount(1000) ->paymentView();
2. Return & callback routes
You need to set 2 routes names in config/atos.php, each with post method :
customer_return_route_name: allows your users to return to your site whenever the payment is successful or cancelled. Defaults toatos.return.customer_callback_route_name: route called back by the bank on transaction completion. Defaults toatos.callback.
You may need to exclude the routes from your VerifyCsrfToken middleware.
3. Callback transaction handling
This code should be run in controller of the callback route.
$verify = app()->make(Verify::class); // you can access all callback data using $allParameters = $verify->getParameters(); // or specify a field using $paymentNumber = $verify->getParameter('transactionReference'); try { $success = $verify->isSuccess(); if ($success) { // handle successful payment } else { // handle error payment } echo "OK"; } catch (InvalidSignature $e) { Log::alert('Invalid payment signature detected'); }
Licence
This package is licenced under the MIT license
Thanks
This package is inspired by devpark/laravel-paybox-gateway.
matthv/laravel-atos-sips-gateway 适用场景与选型建议
matthv/laravel-atos-sips-gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 783 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 01 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 matthv/laravel-atos-sips-gateway 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matthv/laravel-atos-sips-gateway 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 783
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-31