1. Go to this page and download the library: Download extreme-bg/borica-emv-3ds 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/ */
use BogdanKovachev\Borica\Borica;
use BogdanKovachev\Borica\SigningAlgorithm;
use BogdanKovachev\Borica\TransactionType;
use BogdanKovachev\Borica\Request\SaleRequest;
$request = new SaleRequest();
$request->setTransactionType(TransactionType::SALE)
->setAddendum('AD,TD')
->setAmount(100.0)
->setCountry('bg')
->setCurrency('BGN')
->setDescription('Order via 1337.bg')
->setEmail('[email protected]')
->setMerchant('<МИД>')
->setMerchantName('1337.bg')
->setMerchantTimezone('+02')
->setMerchantUrl('https://1337.bg')
->setNonce(strtoupper(bin2hex(openssl_random_pseudo_bytes(16))))
->setOrder(9001)
->setOrderIdentifier($request->getOrder() . ' Website')
->setTerminal('<ТИД>')
->setTimestamp(time())
->sign($borica);
if (!$request->validate()) {
// List all errors
var_dump($request->getErrors());
}
use BogdanKovachev\Borica\Borica;
use BogdanKovachev\Borica\SigningAlgorithm;
use BogdanKovachev\Borica\TransactionType;
use BogdanKovachev\Borica\Response\Response;
$borica = new Borica();
$borica->setPrivateKey('/var/www/certificates/borica.pem') // Absolute file path
->setPrivateKeyPassword('<Private Key Password>')
->setCertificate('/var/www/certificates/borica.cer') // Absolute file path
->setSandboxMode(true)
->setSigningAlgorithm(SigningAlgorithm::MAC_GENERAL);
$response = Response::withPost($_POST)->verify($borica);
if (!$response->signatureIsVerified) {
...
}
if ($response->isSuccessful()) {
echo '<h1>Плащането е успешно</h1>';
...
} else {
echo '<h1>Възникна грешка при плащане</h1>';
echo '<p>Отговор на сървъра: ' . $response->responseCode . ' - ' . $response->responseCodeDescription() . '</p>';
}
use BogdanKovachev\Borica\Borica;
use BogdanKovachev\Borica\Request\StatusCheckRequest;
use BogdanKovachev\Borica\Response\Response;
use BogdanKovachev\Borica\SigningAlgorithm;
use BogdanKovachev\Borica\TransactionType;
$request = new StatusCheckRequest();
$request->setTransactionType(TransactionType::STATUS_CHECK)
->setNonce(strtoupper(bin2hex(openssl_random_pseudo_bytes(16))))
->setOrder(9001)
->setOriginalTransactionType(TransactionType::SALE)
->setTerminal('<ТИД>')
->sign($borica);
use BogdanKovachev\Borica\Borica;
use BogdanKovachev\Borica\Request\ReversalRequest;
use BogdanKovachev\Borica\Response\Response;
use BogdanKovachev\Borica\SigningAlgorithm;
use BogdanKovachev\Borica\TransactionType;
$request = new ReversalRequest();
$request->setTransactionType(TransactionType::REVERSAL)
->setAddendum('AD,TD')
->setAmount(100.0)
->setCurrency('BGN')
->setDescription('Отмяна на плащане през bulmint.com')
->setInternalReference('<INT_REF>')
->setMerchant('<МИД>')
->setMerchantName('Мебели Дизма')
->setNonce(strtoupper(bin2hex(openssl_random_pseudo_bytes(16))))
->setOrder(9001)
->setOrderIdentifier($request->getOrder() . ' Website')
->setRetrievalReferenceNumber('<RRN>')
->setTerminal('<ТИД>')
->setTimestamp(time())
->sign($borica);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.