Looking to hire Laravel developers? Try LaraJobs

laravel-redsys maintained by conycom

Description
A clean, modern, and simple Redsys payment gateway integration for Laravel.
Last update
2026/08/12 23:29 (dev-main)
License
Links
Downloads
0

Comments
comments powered by Disqus

Laravel Redsys

A clean, modern, and simple Redsys payment gateway integration for Laravel 10, 11, 12, and 13.

Run tests

Features

  • Zero Dependencies: Relies purely on native PHP openssl and hash_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).