cloudcogsio/omnipay-firstatlanticcommerce-gateway

First Atlantic Commerce (FAC) Payment Gateway Driver for Omnipay

v1.0.2.2 2023-12-06 22:57 UTC

This package is auto-updated.

Last update: 2024-04-06 23:52:38 UTC


README

First Atlantic Commerce gateway for the Omnipay PHP payment processing library

Packagist License Packagist Version Packagist PHP Version Support (specify version) GitHub issues GitHub last commit

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements First Atlantic Commerce (FAC) support for Omnipay.

Installation

Via Composer

$ composer require cloudcogsio/omnipay-firstatlanticcommerce-gateway

Gateway Operation Defaults

This gateway driver operates in 3DS mode by default and requires a callback URL to be provided via the 'setReturnUrl' method. The return URL must then implement the 'acceptNotification' method to capture the transaction response from FAC.

The gateway can process non-3DS transactions by explicitly turning off 3DS during gateway configuration.

$gateway->set3DS(false);

Usage

For general usage instructions, please see the main Omnipay repository.

Non-3DS Transactions (Direct Integration)

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();
}

3DS Transactions (Direct Integration)

'returnUrl' required. URL must be https://

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();
}

accept-notification.php Accept transaction response from FAC.

$gateway  = Omnipay::create('FirstAtlanticCommerce_FAC');
$gateway    
    // Password is required to perform response signature verification
    ->setFacPwd('xxxxxxxx');
    
// Signature verification is performed implicitly once the 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();
}

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.