Download the PHP package restoore/laravel-systempay without Composer
On this page you can find all versions of the php package restoore/laravel-systempay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-systempay
Create Systempay payment form for Laravel 5.x
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
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
For Laravel 5.0
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
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
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
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
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
set_params
Method to do massive assignement of parameters
Parameters
array $params associative array of systempay parameters