PHP code example of berarma / cakephp-redsys

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

    

berarma / cakephp-redsys example snippets


$this->loadComponent('Berarma/Redsys.Redsys', [
    // Use 'https://sis.redsys.es/sis/realizarPago' for the real environment
    'url' => 'https://sis-t.redsys.es:25443/sis/realizarPago', // Testing
    'secretKey' => 'QWERTYASDF0123456789',
    'defaults' => [
        'DS_MERCHANT_MERCHANTCODE' => '000000001',
        'DS_MERCHANT_CURRENCY' => '978',
        'DS_MERCHANT_TRANSACTIONTYPE' => '0',
        'DS_MERCHANT_TERMINAL' => '001',
        'DS_MERCHANT_MERCHANTURL' => 'http://example.com/notification',
        'DS_MERCHANT_URLOK' => 'http://example.com/ok',
        'DS_MERCHANT_URLKO' => 'http://example.com/ko',
    ],
]);

$this->loadHelper('Berarma/Redsys.Redsys');

$this->Redsys->request([
    'DS_MERCHANT_ORDER' => time(),
    'DS_MERCHANT_AMOUNT' => '100',
]);

 echo $this->Redsys->renderForm(['id' => 'redsys-form']); 

$response = $this->Redsys->response();

$response->get('DS_ORDER');