{"id":40197451,"url":"https://github.com/vguerrerobosch/redsys-php","last_synced_at":"2026-01-19T20:05:15.527Z","repository":{"id":57077692,"uuid":"210625240","full_name":"vguerrerobosch/redsys-php","owner":"vguerrerobosch","description":"Unofficial yet better PHP library for the Redsys API.","archived":false,"fork":false,"pushed_at":"2021-09-30T16:34:47.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-19T21:53:06.860Z","etag":null,"topics":["redsys-api","redsys-php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vguerrerobosch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-24T14:37:07.000Z","updated_at":"2021-09-30T16:34:50.000Z","dependencies_parsed_at":"2022-08-24T14:56:08.046Z","dependency_job_id":null,"html_url":"https://github.com/vguerrerobosch/redsys-php","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/vguerrerobosch/redsys-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vguerrerobosch%2Fredsys-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vguerrerobosch%2Fredsys-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vguerrerobosch%2Fredsys-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vguerrerobosch%2Fredsys-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vguerrerobosch","download_url":"https://codeload.github.com/vguerrerobosch/redsys-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vguerrerobosch%2Fredsys-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28583644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T19:46:29.903Z","status":"ssl_error","status_checked_at":"2026-01-19T19:45:54.560Z","response_time":67,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["redsys-api","redsys-php"],"created_at":"2026-01-19T20:05:15.436Z","updated_at":"2026-01-19T20:05:15.508Z","avatar_url":"https://github.com/vguerrerobosch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redsys PHP bindings\n![Packagist Version](https://img.shields.io/packagist/v/vguerrerobosch/redsys-php?style=flat-square)\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n![Travis (.org)](https://img.shields.io/travis/vguerrerobosch/redsys-php)\n\nThis unofficial Redsys PHP library provides convenient access to the Redsys API from applications written in the PHP language.\n\n## Requirements\n\nPHP 5.6.0 and later.\n\n## Composer\n\nYou can install the library via [Composer](http://getcomposer.org/). Run the following command:\n\n```bash\ncomposer require vguerrerobosch/redsys-php\n```\n\n## Manual Installation\n\nIf 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.\n\n```php\nrequire_once('/path/to/redsys-php/init.php');\n```\n\n## Getting Started\n\n### Payment Requests\n\nYou can create a payment request \n\n```php\nuse Vguerrerobosch\\Redsys\\Redsys;\nuse Vguerrerobosch\\Redsys\\PaymentRequest;\n\nRedsys::setApiKey('sq7HjrUOBfKmC576ILgskD5srU870gJ7');\n\n$payment_request = PaymentRequest::create([\n    'amount' =\u003e 2000,\n    'order' =\u003e time(),\n    'merchant_code' =\u003e 999008881,\n    'merchant_url' =\u003e 'https://941a2b9e.ngrok.io/webhook',\n    'url_ok' =\u003e 'http://redsys-php.test/ok',\n    'url_ko' =\u003e 'http://redsys-php.test/ko',\n]);\n```\n\nthen you can build the form like:\n\n```php\n$sumbit_onload = false; // default true\n\n$payment_request-\u003eform($submit_onload);\n```\n\nor you may access the properties directly:\n\n```php\n$payment_request-\u003eurl; // the Redsys endpoint\n$payment_request-\u003eparams; // the encoded parameters\n$payment_request-\u003esignature; // the calculated signature\n$payment_request-\u003esignature_version // currently HMAC_SHA256_V1\n```\n\n### Handling webhooks\n\nThe very first thing should be verifing the signature of the request:\n\n```php\nuse Vguerrerobosch\\Redsys\\Webhook as Webhook;\nuse Vguerrerobosch\\Redsys\\Exception\\SignatureVerificationException;\n\n$content_type = $_SERVER['CONTENT_TYPE'];\n\nWebhook::setContentType($content_type); // defaults to application/x-www-form-urlencoded\n\n$payload = $content_type == 'application/x-www-form-urlencoded' ?\n    $_POST :\n    @file_get_contents('php://input');\n\n$secret_key = 'sq7HjrUOBfKmC576ILgskD5srU870gJ7';\n\ntry {\n    Webhook::verifySignature($payload, $secret_key);\n} catch (SignatureVerificationException $exception) {\n    http_response_code(403);\n    die;\n}\n```\n\nthen get the data from the response payload and update the order status on your database or whatever needs to be done.\n\n```php\n$data = Webhook::getData($payload);\n```\n\nand finally return the response (required for SOAP)\n\n```php\necho Webhook::response($order_id, $secret_key);\ndie;\n```\n\n## Testing\n### Test card numbers\nGenuine 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.\n\nCard number | Description\n------------|------------\n`4548 8120 4940 0004` | Visa charge succeeded.\n`5576 4400 2278 8500` | MasterCard charge is declined with `9551` response code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvguerrerobosch%2Fredsys-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvguerrerobosch%2Fredsys-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvguerrerobosch%2Fredsys-php/lists"}