Redsys payments with Laravel
You can install the package via composer:
composer require itemvirtual/ecommerce-redsysPublish config (with --force option to update)
php artisan vendor:publish --provider="Itemvirtual\EcommerceRedsys\EcommerceRedsysServiceProvider" --tag=configAdd this environment variable to your .env
ECOMMERCE_REDSYS_ENVIRONMENT=test # or live
ECOMMERCE_REDSYS_KEY="sq7HjrUOBfKmC576ILgskD5srU870gJ7"
ECOMMERCE_REDSYS_CODE="999008881"
ECOMMERCE_REDSYS_TERMINAL=1
ECOMMERCE_REDSYS_CURRENCY=978
ECOMMERCE_REDSYS_LANGUAGE="001"
ECOMMERCE_REDSYS_NOTIFICATION_URL="${APP_URL}/redsys-notification-url"
ECOMMERCE_REDSYS_URL_OK="${APP_URL}/redsys-ok-url"
ECOMMERCE_REDSYS_URL_KO="${APP_URL}/redsys-ko-url"
ECOMMERCE_REDSYS_TRADE_NAME="${APP_NAME}"
ECOMMERCE_REDSYS_TITULAR="Your company name"Add your ECOMMERCE_REDSYS_NOTIFICATION_URL to your app/Http/Middleware/VerifyCsrfToken middleware
protected $except = [
'redsys-notification-url'
];use Itemvirtual\EcommerceRedsys\EcommerceRedsys;
$EcommerceRedsys = new EcommerceRedsys();
$redsysForm = $EcommerceRedsys->setAmount(100)
->setMerchantData('YourMerchantData')
->setDescription('Purchase title')
->setSubmitButtonTitle('Pay button text')
->createForm();Available methods
$EcommerceRedsys = new EcommerceRedsys();
$params = $EcommerceRedsys->setAmount(100)
->setOrder(time())
->setMerchantData('YourMerchantData')
->setDescription('Purchase title')
->setMerchantcode('Your Custom Data')
->setCurrency(999)
->setLanguage('Your Custom Data')
->setTransactiontype('Your Custom Data')
->setTerminal(1)
->setMethod('Your Custom Data')
->setNotificationUrl('Your Custom Data')
->setUrlOk('Your Custom Data')
->setUrlKo('Your Custom Data')
->setTradeName('Your Custom Data')
->setTitular('Your Custom Data')
->setEnvironment('test')
->setSubmitButtonName('Your Custom Button title')
->setSubmitButtonTitle('Your Custom Button title')
->setSubmitButtonId('Your Custom Button title')
->setSubmitButtonClass('Your Custom Button title')
->debugParameters();use Itemvirtual\EcommerceRedsys\EcommerceRedsys;
$EcommerceRedsys = new EcommerceRedsys();
$parameters = $EcommerceRedsys->getMerchantParameters($request->get('Ds_MerchantParameters'));
$yourMerchantData = $EcommerceRedsys->getMerchantData($request->get('Ds_MerchantParameters'));
// validate payment
$isValid = $EcommerceRedsys->checkValidPayment($request->all());Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.