softlogic-gt/laravel-facgateway

There is no license information available for the latest version (v1.0.4) of this package.

Laravel FAC Gateway

v1.0.4 2024-04-30 22:14 UTC

This package is auto-updated.

Last update: 2024-04-30 22:14:51 UTC


README

Send payment transactions to First Atlantic Commerce service. You must have an active account for this to work. The package automatically validates all input data, generates HTML and redirects to specified route.

Installation

composer require softlogic-gt/laravel-facgateway

Set your environment variables

FAC_TEST=true
FAC_ID=818181818
FAC_PASSWORD=fadsfadsfdasfda1231231232fasf
FAC_REDIRECT=http://localhost/facresponse
FAC_SUCCESS_ACTION=FacController@success
FAC_ERROR_ACTION=FacController@error

Usage

In the constructor, if the email is specified, a confirmation receipt is sent. The default subject is Comprobante de pago.

Sale

use SoftlogicGT\FacGateway\FacGateway;

$creditCard = '4000000000000416';
$expirationMonth = '2';
$expirationYear = '26';
$cvv2 = '123';
$amount = 1230.00;
$externalId = '557854';

$server = new FacGateway();

$html = $server->sale($creditCard, $expirationMonth, $expirationYear, $cvv2, $amount, $externalId);

It will throw an exception if any error is received from FAC, or an HTML to render for 3DS validation

After rendering the HTML, you will get a POST request to FAC_REDIRECT, where you have to process the correct response, and you should handle that response like this:

    $fc = new FacGateway([
        'receipt' => [
            'name'  => 'Juan Samara',
            'email' => 'jgalindo@softlogic.com.gt',
        ],
    ]);

    return $fc->callback($request);

This will then call the corresponding actions specified in the FAC_SUCCESS_ACTION or FAC_ERROR_ACTION