PHPackages                             eseperio/omnipay-redsys - 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. eseperio/omnipay-redsys

ActiveLibrary

eseperio/omnipay-redsys
=======================

Redsys (Credit card + Bizum) payment gateway for the Omnipay PHP payment processing library

v2.0.1(2mo ago)08.0k↓40%1GPL-2.0-or-laterPHPPHP &gt;=7.2.5

Since Nov 10Pushed 2mo agoCompare

[ Source](https://github.com/Eseperio/omnipay-redsys)[ Packagist](https://packagist.org/packages/eseperio/omnipay-redsys)[ RSS](/packages/eseperio-omnipay-redsys/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (17)Used By (0)

Omnipay: Redsys (+bizum) driver
===============================

[](#omnipay-redsys-bizum-driver)

Versiondepends on guzzlehttp/psr71.x 1.x2.x2.x / php &gt;7.4.5**RedSys driver for the Omnipay PHP payment processing library**

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP &gt;7.1 This package implements RedSys (formerly Sermepa) support for Omnipay.

This is an improved version of the original package by [nazka](nazka/sermepa-omnipay) which seems to be stalled since years ago.

#### This package features:

[](#this-package-features)

- Support for Omnipay 3.X
- Support for Redsys 3DS2
- Support for Redsys Bizum
- Dictionary of Redsys payment methods
- Dictionary of transaction types
- Transaction compatibility with payment method is checked to ensure validity of request
- JSON dictionary with all error codes
- Better docs and how it works explanations
- Dictionary with all languages supported by Redsys

Installation
------------

[](#installation)

Via [Composer](http://getcomposer.org/). To install, simply run:

```
composer require eseperio/omnipay-redsys
```

### How it works

[](#how-it-works)

In order to understand the code included within this library, you should check the docs page [how it works](docs/how-it-works.md)

### List of errors

[](#list-of-errors)

Redsys has a list of errors that can be returned by the gateway. You can find the list of errors [here](docs/error-codes.md). Also the whole list is available in JSON format [here](src/utils/error-codes.json)

Basic Usage
-----------

[](#basic-usage)

Create a gateway instance for RedSys:

```
$gateway = Omnipay::create('Redsys');
```

Now define all the parameters needed by the gateway:

```
$gateway->setMerchantCode('my_merchant_code');
$gateway->setMerchantKey('my_merchant_key');
$gateway->setTransactionType(\Omnipay\Redsys\Dictionaries\TransactionTypes::AUTHORIZATION);
$gateway->setCurrency('my_currency');
$gateway->setMerchantName('my_shop_name');
$gateway->setMerchantPaymethod('my_pay_method');
$gateway->setSignatureMode('my_signature_mode');
$gateway->setConsumerLanguage(0);
$gateway->setTerminal('my_terminal');
```

`setMerchantUrl` is the url where the gateway will send the response of the transaction. This url must be accessible

Next, create a request, which can be either a purchase (common) or an authorize request:

```
$request = $gateway->purchase()
            // Define the urls
            ->setCancelUrl('my_cancel_url')
            ->setReturnUrl('my_return_url')
            ->setMerchantUrl('my_merchant_url')
            // Define the transaction
            ->setTitular('my_company_name')
            ->setAmount('my_total_amount')
            ->setTransactionId('my_transaction_id')
            ->setOrder('my_order_id')
            ->setTransactionReference('my_transaction_reference')
            ->setDescription('my_order_description')

            // Optional.
            ->setConsumerLanguage(\Omnipay\Redsys\Dictionaries\Languages::SPANISH);

    ],
]);
```

> **Important**: Redsys expects the transactionId to be an integer, and the amount to be an integer where the last 2 digits are decimals.

Omnipay has many methods to set the amount, but this library has the overridden method `setAmount` to ensure that the amount is an integer and the last 2 digits are decimals. We highly recommend using this method unless you are using [Money library](moneyphp/money), in that case use `setMoney(Money $money)`

When you use `setAmount()`, the amount is formatted with `number_format($amount, 2, '', '')`. You still can use [`setAmountInteger()`](https://github.com/thephpleague/omnipay-common/blob/e1ebc22615f14219d31cefdf62d7036feb228b1c/src/Common/Message/AbstractRequest.php#L355)to set the amount as an integer.

Receiving the payment response
------------------------------

[](#receiving-the-payment-response)

> Previously, a fake request was created to simulate the response from Redsys, but since Omnipay 3.0, acceptNotification must be used to receive the response from the gateway.

#### New way (acceptNotification)

[](#new-way-acceptnotification)

```
$gateway = Omnipay::create('Redsys');
$gateway->initialize([
   'merchantId' => '123456789',
   'merchantKey' => 'sq7HjrUOBfKmC576ILgskD5srU870gJ7',
   ...
]);
$notification = $gateway->acceptNotification();
if ($notification->getTransactionStatus() === NotificationInterface::STATUS_COMPLETED) {
   // Payment was successful
  $transactionReference = $notification->getTransactionReference();
 // Do your stuff here
} else {
  // Payment failed
$message = $notification->getMessage();
// Do your stuff here
}
```

#### Old way (completePurchase)

[](#old-way-completepurchase)

Now, on the route you provided as `merchantUrl` you can receive the response from Redsys:

```
$gateway = Omnipay::create('Sermepa');
$response = $gateway->completePurchase()->send();
if($response->isSuccessful()){
    // The payment was successful
    // Confirm your order or other stuff

    $orderId = $response->getTransactionId();

    // ...
}
```

### Using BIZUM

[](#using-bizum)

All the params are shared between card and bizum, so you can use the same gateway instance to create a bizum request. The only difference is the payment method:

```
// Set the payment method to BIZUM
$request->setPayMethod(PayMethods::PAY_METHOD_BIZUM);
// Bizum is only compatible with AUTHORIZATION transactions
$gateway->setTransactionType(TransactionTypes::AUTHORIZATION);
```

For other general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)repository.

Upgrade to Omnipay 3.X
----------------------

[](#upgrade-to-omnipay-3x)

Changes for use with Omnipay 3.0

- Currency: Use the code of ISO-4217 ([https://en.wikipedia.org/wiki/ISO\_4217#Active\_codes](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)) instead a number. (' EUR' =&gt; '978')

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~314 days

Recently: every ~274 days

Total

13

Last Release

69d ago

Major Versions

0.2.5 → 1.0.02023-03-07

v1.2.2 → 2.0.02025-12-09

PHP version history (2 changes)0.2.2PHP &gt;=5.6

2.0.0PHP &gt;=7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1e173755eb4a5abae378ed4c8a8e8066f578c3192105c5e3f9b8ea3ef0086e7?d=identicon)[Eseperio](/maintainers/Eseperio)

---

Top Contributors

[![Eseperio](https://avatars.githubusercontent.com/u/5459366?v=4)](https://github.com/Eseperio "Eseperio (29 commits)")[![jsampedro77](https://avatars.githubusercontent.com/u/1857630?v=4)](https://github.com/jsampedro77 "jsampedro77 (23 commits)")[![nerburish](https://avatars.githubusercontent.com/u/5610788?v=4)](https://github.com/nerburish "nerburish (6 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (5 commits)")[![ebisbe](https://avatars.githubusercontent.com/u/6747962?v=4)](https://github.com/ebisbe "ebisbe (4 commits)")[![drmonkeyninja](https://avatars.githubusercontent.com/u/357623?v=4)](https://github.com/drmonkeyninja "drmonkeyninja (3 commits)")[![urtzip](https://avatars.githubusercontent.com/u/15788963?v=4)](https://github.com/urtzip "urtzip (2 commits)")[![joshnts](https://avatars.githubusercontent.com/u/107925204?v=4)](https://github.com/joshnts "joshnts (2 commits)")[![kingio](https://avatars.githubusercontent.com/u/11076573?v=4)](https://github.com/kingio "kingio (2 commits)")[![libertogimenez](https://avatars.githubusercontent.com/u/1241558?v=4)](https://github.com/libertogimenez "libertogimenez (2 commits)")[![mfcanovas](https://avatars.githubusercontent.com/u/4291095?v=4)](https://github.com/mfcanovas "mfcanovas (1 commits)")[![ramonnitsnets](https://avatars.githubusercontent.com/u/121854417?v=4)](https://github.com/ramonnitsnets "ramonnitsnets (1 commits)")[![ramon-nts](https://avatars.githubusercontent.com/u/121854417?v=4)](https://github.com/ramon-nts "ramon-nts (1 commits)")[![devnix](https://avatars.githubusercontent.com/u/1777519?v=4)](https://github.com/devnix "devnix (1 commits)")

### Embed Badge

![Health badge](/badges/eseperio-omnipay-redsys/health.svg)

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

###  Alternatives

[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.6k9.4M48](/packages/laravel-reverb)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[vin-sw/shopware-sdk

A PHP SDK for Shopware 6 Platform

122469.3k6](/packages/vin-sw-shopware-sdk)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)[php-heroku-client/php-heroku-client

A PHP client for the Heroku Platform API

24404.8k4](/packages/php-heroku-client-php-heroku-client)

PHPackages © 2026

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