conycom / laravel-redsys
A clean, modern, and simple Redsys payment gateway integration for Laravel.
dev-main
2026-08-12 21:29 UTC
Requires
- php: ^8.2
- ext-openssl: *
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.0|^11.0
This package is auto-updated.
Last update: 2026-08-13 06:12:43 UTC
README
A clean, modern, and simple Redsys payment gateway integration for Laravel 10, 11, 12, and 13.
Features
- Zero Dependencies: Relies purely on native PHP
opensslandhash_hmac. - Framework Agnostic Models: Doesn't force you to use specific database structures.
- HMAC SHA256 & 3DES encryption: Implements the official Redsys cryptographic requirements.
Installation
composer require conycom/laravel-redsys
Publish the configuration file:
php artisan vendor:publish --tag="redsys-config"
Configuration
Update your .env file with the credentials provided by your bank:
REDSYS_MERCHANT_CODE=123456789 REDSYS_TERMINAL=1 REDSYS_CURRENCY=978 REDSYS_SECRET_KEY=sq7HjrUOBfKmC576ILgskD5srU870gJ7 REDSYS_ENVIRONMENT=sandbox
Usage
1. Generating a Payment Form
use Conycom\Redsys\Facades\Redsys; $orderId = 'ORD001'; $amount = 15.50; // EUR $callbackUrl = route('payment.callback'); $form = Redsys::generatePaymentForm($orderId, $amount, $callbackUrl); // Pass $form['url'] and $form['payload'] to your Blade view to build a form that auto-submits.
2. Processing the Notification / Callback
use Conycom\Redsys\Facades\Redsys; public function handleCallback(Request $request) { $result = Redsys::processNotification($request->all()); if ($result['success']) { $orderId = $result['order_id']; $amount = $result['amount']; // Mark order as paid! } else { $error = $result['error']; // Handle failure } }
License
The MIT License (MIT).