https://github.com/matthv/laravel-atos-sips-gateway
Atos SIPS payment gateway for Laravel
https://github.com/matthv/laravel-atos-sips-gateway
atos-sips laravel laravel-payment payment-gateway transaction
Last synced: about 1 month ago
JSON representation
Atos SIPS payment gateway for Laravel
- Host: GitHub
- URL: https://github.com/matthv/laravel-atos-sips-gateway
- Owner: matthv
- License: mit
- Created: 2021-01-31T00:03:49.000Z (over 4 years ago)
- Default Branch: 1.x
- Last Pushed: 2022-02-13T15:08:25.000Z (over 3 years ago)
- Last Synced: 2025-03-29T14:35:08.543Z (about 2 months ago)
- Topics: atos-sips, laravel, laravel-payment, payment-gateway, transaction
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Atos SIPS Payment
---
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](https://documentation.sips.worldline.com/fr/WLSIPS.326-UG-Guide-de-demarrage-rapide.html)---
## 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 : `true` to 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](https://documentation.mercanet.bnpparibas.net/index.php?title=Premiers_pas) - [Dashboard-info](https://documentation.mercanet.bnpparibas.net/index.php?title=Obtenir_sa_cl%C3%A9_secr%C3%A8te)---
## 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.**
```php
return app()->make(AtosSipsAuthorization::class)
->setPaymentNumber('AABBAA'.rand(1000,9999))
->setAmount(1000)
->paymentView();
```
You can add Atos SIPS custom fields with the `setCustomParameter` method.```php
return app()->make(AtosSipsAuthorization::class)
->setPaymentNumber('AABBAA'.rand(1000,9999))
->setCustomParameters(
[
'customerEmail' => '[email protected]',
'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 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.
### 3. Callback transaction handling
This code should be run in controller of the callback route.
```php
$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](http://opensource.org/licenses/MIT)
## Thanks
This package is inspired by [devpark/laravel-paybox-gateway](https://github.com/devpark/laravel-paybox-gateway).