1. Go to this page and download the library: Download vguerrerobosch/redsys-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$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
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;
}