PHP code example of ensensis / laravel-bac

1. Go to this page and download the library: Download ensensis/laravel-bac 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/ */

    

ensensis / laravel-bac example snippets


$authorization = new Authorization($creditCardNumber, $expirationDate, $cvv, $amount, $orderId);
$transaction = \Bac::checkout($authorization);

public function procesarPago(Bac $bac){ 
    $authorization = new Authorization($creditCardNumber, $expirationDate, $cvv, $amount, $orderId);
    $transaction = $bac->checkout($authorization);
}

// true or false
if ($transaction->isSuccess()){
    $transactionid = $transaction->getTransactionid();
    // ... 
}
else{
    echo $transaction->getResponseText();
    // Duplicate transaction REFID:2419279107
}