PHP code example of metadrop / redsys-consultas-php

1. Go to this page and download the library: Download metadrop/redsys-consultas-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/ */

    

metadrop / redsys-consultas-php example snippets




edsysConsultasPHP\Client\Client;

$url = 'https://sis-t.redsys.es:25443/apl02/services/SerClsWSConsulta';
$logger = new \Monolog\Logger;('log');
$logger->pushHandler(new \Monolog\Handler\RotatingFileHandler('dir_to_log/name_of_log.log'));
$config = [
  'logger' => $logger,
  'logger_format' => '{request}',
];
$client = new Client($url, 'Introduce your merchant password', $config);

$order = 'Introduce your order';
$terminal = 'Introduce your terminal';
$merchant_code = 'Introduce your merchant code';
$response = $client->getTransactionsByDateRangeAndType($order, $terminal, $merchant_code);

print_r($response);




edsysConsultasPHP\Client\Client;

$url = 'https://sis-t.redsys.es:25443/apl02/services/SerClsWSConsulta';
$logger = new \Monolog\Logger;('log');
$logger->pushHandler(new \Monolog\Handler\RotatingFileHandler('dir_to_log/name_of_log.log'));
$config = [
  'logger' => $logger,
  'logger_format' => '{request}',
];
$client = new Client($url, 'Introduce your merchant password', $config);

$terminal = 'Introduce your terminal';
$merchant_code = 'Introduce your merchant code';
// Note: Period shouldn't be bigger than 15 days and start date can't be older than 1 year.
$start_date = "2021-05-01-00.00.00.000000"; // Y-m-d-H.i.s.000000
$end_date = "2021-05-14-23.59.59.000000"; // Y-m-d-H.i.s.000000


$response = $client->getTransactionsByDateRange($terminal, $merchant_code, $start_date, $end_date);

print_r($response);

bash
composer