PHP code example of cloudcogsio / omnipay-firstatlanticcommerce-gateway

1. Go to this page and download the library: Download cloudcogsio/omnipay-firstatlanticcommerce-gateway 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/ */

    

cloudcogsio / omnipay-firstatlanticcommerce-gateway example snippets


$gateway->set3DS(false);

$gateway  = Omnipay::create('FirstAtlanticCommerce_FAC');
$gateway    
    // Password is he gateway was initialized with the password.
$response = $gateway->acceptNotification($_POST)->send();

if($response->isSuccessful())
{       
    // Purchase was succussful, continue order processing
    ...
}
else 
{
    // Transaction failed
    echo $response->getMessage();
}
 php

use Omnipay\Omnipay;
try {
    $gateway = Omnipay::create('FirstAtlanticCommerce_FAC');
    $gateway
        ->setTestMode(true)
        ->setIntegrationOption(\Omnipay\FirstAtlanticCommerce\Constants::GATEWAY_INTEGRATION_DIRECT)
        ->setFacId('xxxxxxxx')
        ->setFacPwd('xxxxxxxx')
        ->set3DS(false);

    $cardData = [
        'number' => '4111111111111111',
        'expiryMonth' => '01',
        'expiryYear' => '2025',
        'cvv' => '123'
    ];

    $transactionData = [
        'card' => $cardData,
        'currency' => 'USD',
        'amount' => '1.00',
        'transactionId' => 'OrderNo-2100001'
    ];

    $response = $gateway->purchase($transactionData)->send();

    if($response->isSuccessful())
    {
        // Verify response
        $response->verifySignature();
        
        // Purchase was succussful, continue order processing
        ...
    }
} catch (Exception $e){
    $e->getMessage();
}
 php

use Omnipay\Omnipay;
try {
    $gateway = Omnipay::create('FirstAtlanticCommerce_FAC');
    $gateway
        ->setTestMode(true)
        ->setIntegrationOption(\Omnipay\FirstAtlanticCommerce\Constants::GATEWAY_INTEGRATION_DIRECT)
        ->setFacId('xxxxxxxx')
        ->setFacPwd('xxxxxxxx')
        ->set3DS(true)
        
        // **Required and must be https://
        ->setReturnUrl('https://localhost/accept-notification.php');

    $cardData = [
        'number' => '4111111111111111',
        'expiryMonth' => '01',
        'expiryYear' => '2025',
        'cvv' => '123'
    ];

    $transactionData = [
        'card' => $cardData,
        'currency' => 'USD',
        'amount' => '1.00',
        'transactionId' => 'OrderNo-2100001'
    ];

    $response = $gateway->purchase($transactionData)->send();

    if($response->isRedirect())
    {
	    // Redirect to continue 3DS verification
        $response->redirect();
    }
    else 
    {
	    // 3DS transaction failed setup, show error reason.
        echo $response->getMessage();
    }
} catch (Exception $e){
    $e->getMessage();
}