Atos SIPS payment gateway for Laravel
MIT License
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
composer require matthv/laravel-atos-sips-gateway
php artisan vendor:publish --provider="Matthv\AtosSipsGateway\Providers\AtosSipsServiceProvider"
Most of the values come from the Atos dashboard. You should put the following variables into your .env file :
true
to use test environment. Defaults to true.https://payment-webinit.mercanet.bnpparibas.net/paymentInit
.https://payment-webinit-mercanet.test.sips-atos.com/paymentInit
.You can see all configuration options in config/atos.php
.
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
To make a basic payment, you will need at least 2 information :
transactionReference
.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' => '[email protected]',
'customerId' => 123,
'orderId' => 456,
]
)
->setAmount(1000)
->paymentView();
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 to atos.return
.customer_callback_route_name
: route called back by the bank on transaction completion. Defaults to atos.callback
.You may need to exclude the routes from your VerifyCsrfToken middleware.
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');
}
This package is licenced under the MIT license
This package is inspired by devpark/laravel-paybox-gateway.