1. Go to this page and download the library: Download veneliniliev/borica-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/ */
veneliniliev / borica-3ds example snippets
$saleRequest->setSigningSchemaMacGeneral(); // use MAC_GENERAL
$saleRequest->setSigningSchemaMacExtended(); // use MAC_EXTENDED
$saleRequest->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
use VenelinIliev\Borica3ds\SaleRequest;
// ...
$saleRequest = (new SaleRequest())
->setAmount(123.32)
->setOrder(123456)
->setDescription('test')
->setMerchantUrl('https://test.com') // optional
->setTerminalID('<TID - V*******>')
->setMerchantId('<MID - 15 chars>')
->setPrivateKey('\<path to certificate.key>', '<password / or use method from bottom>')
->setMInfo(array( // Mandatory cardholderName and ( email or MobilePhone )
'email'=>'[email protected]',
'cardholderName'=>'CARDHOLDER NAME', // Max 45 chars
'mobilePhone'=> array(
'cc'=>'359', // Country code
'subscriber'=>'8939999888', // Subscriber number
),
'threeDSRequestorChallengeInd'=>'04', // Optional for Additional Authentication
))
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
->setPrivateKeyPassword('test');
$formHtml = $saleRequest->generateForm(); // only generate hidden html form with filled inputs
// OR
$saleRequest->send(); // generate and send form with js
use VenelinIliev\Borica3ds\SaleResponse;
// ....
$isSuccessfulPayment = (new SaleResponse())
->setPublicKey('<path to public certificate.cer>')
->setResponseData($_POST) //Set POST data from borica response
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
->isSuccessful();
use VenelinIliev\Borica3ds\SaleResponse;
// ...
$saleResponse= (new SaleResponse())
->setPublicKey('<path to public certificate.cer>')
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
// ...
// automatic fill data from $_POST or can be set by ->setResponseData(<array>)
// ...
$saleResponse->getResponseCode(); // return RC from response
$saleResponse->getVerifiedData('<key from post request ex: RC>'); // return verified data from post by key
$saleResponse->isSuccessful(); // RC === 00 and data is verified
use VenelinIliev\Borica3ds\Enums\TransactionType;
use VenelinIliev\Borica3ds\StatusCheckRequest;
// ...
$statusCheckRequest = (new StatusCheckRequest())
//->inDevelopment()
->setPrivateKey('\<path to certificate.key>', '<password / or use method from bottom>')
->setPublicKey('<path to public certificate.cer>')
->setTerminalID('<TID - V*******>')
->setOrder('<order>')
->setOriginalTransactionType(TransactionType::SALE()) // transaction type
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
//send to borica
$statusCheckResponse = $statusCheckRequest->send();
// get data from borica response
$verifiedResponseData = $statusCheckResponse->getResponseData();
// get field from borica response
$statusCheckResponse->getVerifiedData('<field from response. ex: ACTION');
use VenelinIliev\Borica3ds\ReversalRequest;
// ...
$reversalRequest = (new ReversalRequest())
//->inDevelopment()
->setPrivateKey('\<path to certificate.key>', '<password / or use method from bottom>')
->setPublicKey('<path to public certificate.cer>')
->setTerminalID('<TID - V*******>')
->setAmount(123.32)
->setOrder(123456)
->setDescription('test reversal')
->setMerchantId('<MID - 15 chars>')
->setRrn('<RRN - Original transaction reference (From the sale response data)>')
->setIntRef('<INT_REF - Internal reference (From the sale response data)>')
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
//send reversal request to borica
$reversalRequestResponse = $reversalRequest->send();
// get data from borica reversal response
$verifiedResponseData = $reversalRequestResponse->getResponseData();
// get field from borica reversal response
$reversalRequestResponse->getVerifiedData('STATUSMSG');
use VenelinIliev\Borica3ds\PreAuthorisationRequest;
// ...
$preAuthorisationRequest = (new PreAuthorisationRequest())
->setAmount(123.32)
->setOrder(123456)
->setDescription('test')
->setMerchantUrl('https://test.com') // optional
->setTerminalID('<TID - V*******>')
->setMerchantId('<MID - 15 chars>')
->setPrivateKey('\<path to certificate.key>', '<password / or use method from bottom>')
->setMInfo(array( // Mandatory cardholderName and ( email or MobilePhone )
'email'=>'[email protected]',
'cardholderName'=>'CARDHOLDER NAME', // Max 45 chars
'mobilePhone'=> array(
'cc'=>'359', // Country code
'subscriber'=>'8939999888', // Subscriber number
),
'threeDSRequestorChallengeInd'=>'04', // Optional for Additional Authentication
))
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
->setPrivateKeyPassword('test');
$formHtml = $preAuthorisationRequest->generateForm(); // only generate hidden html form with filled inputs
// OR
$preAuthorisationRequest->send(); // generate and send form with js
$response = (new PreAuthorisationCompletionRequest())
//->inDevelopment()
->setPrivateKey('\<path to certificate.key>', '<password / or use method from bottom>')
->setPublicKey('<path to public certificate.cer>')
->setTerminalID('<TID - V*******>')
->setAmount(123.32)
->setOrder(123456)
->setDescription('test reversal')
->setMerchantId('<MID - 15 chars>')
->setRrn('<RRN - Original transaction reference (From the sale response data)>')
->setIntRef('<INT_REF - Internal reference (From the sale response data)>')
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
->send();
$isSuccessful = $response->getVerifiedData('ACTION') === Action::SUCCESS &&
$response->isSuccessful();
$response = (new PreAuthorisationReversalRequest())
//->inDevelopment()
->setPrivateKey('\<path to certificate.key>', '<password / or use method from bottom>')
->setPublicKey('<path to public certificate.cer>')
->setTerminalID('<TID - V*******>')
->setAmount(123.32)
->setOrder(123456)
->setDescription('test reversal')
->setMerchantId('<MID - 15 chars>')
->setRrn('<RRN - Original transaction reference (From the sale response data)>')
->setIntRef('<INT_REF - Internal reference (From the sale response data)>')
//->setSigningSchemaMacGeneral(); // use MAC_GENERAL
//->setSigningSchemaMacExtended(); // use MAC_EXTENDED
//->setSigningSchemaMacAdvanced(); // use MAC_ADVANCED
->send();
$isSuccessful = $response->getVerifiedData('ACTION') === Action::SUCCESS &&
$response->isSuccessful();
$boricaResponse = (Response::determineResponse())
$saleRequest->setEnvironment(true); // set to production
$saleRequest->setEnvironment(false); // set to development
$saleRequest->inDevelopment(); // set to development
$saleRequest->inProduction(); // set to production
$saleRequest->isProduction(); // check is production environment?
$saleRequest->isDevelopment(); // check is development environment?
use VenelinIliev\Borica3ds\SaleRequest;
use VenelinIliev\Borica3ds\Enums\Language;
$saleRequest = (new SaleRequest())
->setAmount(100.50) // Transaction amount.
->setOrder('123456') // Unique order number.
->setDescription('Test product purchase') // Order description.
->setTerminalID('<TID - V*******>') // Terminal ID.
->setMerchantId('<MID - 15 chars>') // Merchant ID.
->setPrivateKey('<path to private key>', '<password>')
->setLang(Language::EN()); // Set transaction language to English.
// Alternatively, set the language to Bulgarian.
$saleRequest->setLang(Language::BG());
$saleRequest->setLang('DE'); // Throws exception because 'DE' is not supported.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.