PHP code example of nowo-tech / redsys-php
1. Go to this page and download the library: Download nowo-tech/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/ */
nowo-tech / redsys-php example snippets
use Nowo\Redsys\Currency;
use Nowo\Redsys\Environment;
use Nowo\Redsys\Merchant;
use Nowo\Redsys\MerchantParameters;
use Nowo\Redsys\RedirectForm;
use Nowo\Redsys\SignatureVersion;
use Nowo\Redsys\TransactionType;
$merchant = new Merchant(
merchantCode: '999008881',
terminal: '1',
secretKey: getenv('REDSYS_SECRET_KEY') ?: '',
environment: Environment::Test,
signatureVersion: SignatureVersion::HmacSha512V2,
);
$params = MerchantParameters::create()
->forMerchant($merchant)
->amount(145)
->order('1444904795')
->currency(Currency::Eur)
->transactionType(TransactionType::Authorization)
->merchantUrl('https://example.test/redsys/notify')
->urlOk('https://example.test/ok')
->urlKo('https://example.test/ko');
$html = RedirectForm::forMerchant($merchant, $params);
sh
composer