PHPackages                             vguerrerobosch/redsys-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vguerrerobosch/redsys-php

ActiveLibrary

vguerrerobosch/redsys-php
=========================

Unofficial yet better PHP library for the Redsys API.

v0.1.4(4y ago)11.8k[1 issues](https://github.com/vguerrerobosch/redsys-php/issues)PHP

Since Sep 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/vguerrerobosch/redsys-php)[ Packagist](https://packagist.org/packages/vguerrerobosch/redsys-php)[ RSS](/packages/vguerrerobosch-redsys-php/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (6)Used By (0)

Redsys PHP bindings
===================

[](#redsys-php-bindings)

[![Packagist Version](https://camo.githubusercontent.com/0c6bf59bc0e573b380cd63c60a274191fd2e39b3a8ea7b04efc21b82c9196535/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76677565727265726f626f7363682f7265647379732d7068703f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/0c6bf59bc0e573b380cd63c60a274191fd2e39b3a8ea7b04efc21b82c9196535/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76677565727265726f626f7363682f7265647379732d7068703f7374796c653d666c61742d737175617265)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Travis (.org)](https://camo.githubusercontent.com/4637b57603b34eebf35ffed141b4e6df398840b7bd0bbe649f1ad8a54b3c454a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f76677565727265726f626f7363682f7265647379732d706870)](https://camo.githubusercontent.com/4637b57603b34eebf35ffed141b4e6df398840b7bd0bbe649f1ad8a54b3c454a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f76677565727265726f626f7363682f7265647379732d706870)

This unofficial Redsys PHP library provides convenient access to the Redsys API from applications written in the PHP language.

Requirements
------------

[](#requirements)

PHP 5.6.0 and later.

Composer
--------

[](#composer)

You can install the library via [Composer](http://getcomposer.org/). Run the following command:

```
composer require vguerrerobosch/redsys-php
```

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/Vguerrerobosch/redsys-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once('/path/to/redsys-php/init.php');
```

Getting Started
---------------

[](#getting-started)

### Payment Requests

[](#payment-requests)

You can create a payment request

```
use Vguerrerobosch\Redsys\Redsys;
use Vguerrerobosch\Redsys\PaymentRequest;

Redsys::setApiKey('sq7HjrUOBfKmC576ILgskD5srU870gJ7');

$payment_request = PaymentRequest::create([
    'amount' => 2000,
    'order' => time(),
    'merchant_code' => 999008881,
    'merchant_url' => 'https://941a2b9e.ngrok.io/webhook',
    'url_ok' => 'http://redsys-php.test/ok',
    'url_ko' => 'http://redsys-php.test/ko',
]);
```

then you can build the form like:

```
$sumbit_onload = false; // default true

$payment_request->form($submit_onload);
```

or you may access the properties directly:

```
$payment_request->url; // the Redsys endpoint
$payment_request->params; // the encoded parameters
$payment_request->signature; // the calculated signature
$payment_request->signature_version // currently HMAC_SHA256_V1
```

### Handling webhooks

[](#handling-webhooks)

The very first thing should be verifing the signature of the request:

```
use Vguerrerobosch\Redsys\Webhook as Webhook;
use Vguerrerobosch\Redsys\Exception\SignatureVerificationException;

$content_type = $_SERVER['CONTENT_TYPE'];

Webhook::setContentType($content_type); // defaults to application/x-www-form-urlencoded

$payload = $content_type == 'application/x-www-form-urlencoded' ?
    $_POST :
    @file_get_contents('php://input');

$secret_key = 'sq7HjrUOBfKmC576ILgskD5srU870gJ7';

try {
    Webhook::verifySignature($payload, $secret_key);
} catch (SignatureVerificationException $exception) {
    http_response_code(403);
    die;
}
```

then get the data from the response payload and update the order status on your database or whatever needs to be done.

```
$data = Webhook::getData($payload);
```

and finally return the response (required for SOAP)

```
echo Webhook::response($order_id, $secret_key);
die;
```

Testing
-------

[](#testing)

### Test card numbers

[](#test-card-numbers)

Genuine card information cannot be used in test mode. Instead, use the following test card numbers, a valid expiration date in the future, and any random CVC number, to create a successful payment.

Card numberDescription`4548 8120 4940 0004`Visa charge succeeded.`5576 4400 2278 8500`MasterCard charge is declined with `9551` response code.

###  Health Score

22

—

LowBetter than 25% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~181 days

Total

5

Last Release

1642d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/67029daed3151cef94a100b72be0eaf400c05f6c5f7b9b02a8495538d1471ce5?d=identicon)[vguerrerobosch](/maintainers/vguerrerobosch)

---

Top Contributors

[![vguerrerobosch](https://avatars.githubusercontent.com/u/8974623?v=4)](https://github.com/vguerrerobosch "vguerrerobosch (3 commits)")

---

Tags

redsys-apiredsys-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vguerrerobosch-redsys-php/health.svg)

```
[![Health](https://phpackages.com/badges/vguerrerobosch-redsys-php/health.svg)](https://phpackages.com/packages/vguerrerobosch-redsys-php)
```

###  Alternatives

[payum/payum

One million downloads of Payum already! Payum offers everything you need to work with payments. Friendly for all PHP frameworks (Symfony, Laravel, Laminas, Yii, Silex). Check more visiting site.

1.9k6.6M20](/packages/payum-payum)[payum/core

One million downloads of Payum already! Payum offers everything you need to work with payments. Friendly for all PHP frameworks (Symfony, Laravel, Laminas, Yii, Silex). Check more visiting site.

514.6M159](/packages/payum-core)[fatturaelettronicaphp/fattura-elettronica

Pacchetto PHP per la lettura, la generazione e la validazione della fattura elettronica, sia per la Pubblica Amministrazione che tra privati (B2B)

4948.2k](/packages/fatturaelettronicaphp-fattura-elettronica)[laravel-validation-rules/country-codes

Validate country codes.

34471.0k](/packages/laravel-validation-rules-country-codes)[shopsys/framework

Core of Shopsys Platform - open source framework for building large, scalable, fast-growing e-commerce projects based on Symfony

25206.0k18](/packages/shopsys-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
