PHP code example of mitchdav / st-george-ipg-laravel

1. Go to this page and download the library: Download mitchdav/st-george-ipg-laravel 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/ */

    

mitchdav / st-george-ipg-laravel example snippets


StGeorgeIPG\Laravel\Provider::class,

'IPG' => StGeorgeIPG\Laravel\Facades\IPG::class,



return [
    /**
     * The provider to use to connect to St.George IPG.
     */
    'provider'            => \StGeorgeIPG\Providers\WebService::class,

    /**
     * The client ID, issued by St.George.
     */
    'clientId'            => env('IPG_CLIENT_ID'),

    /**
     * The authentication token, created in the St.George Merchant Administration Console.
     *
     * This is assword' => env('IPG_CERTIFICATE_PASSWORD'),

        /**
         * The path to the certificate file that was issued by St.George.
         */
        'certificatePath'     => env('IPG_CERTIFICATE_PATH', resource_path('webpay/cert.cert')),

        /**
         * Whether to debug the requests and responses.
         */
        'debug'               => env('IPG_DEBUG', FALSE),

        /**
         * The log file path if debugging is enabled.
         */
        'logFile'             => env('IPG_LOG_FILE', storage_path('logs/webpay/' . date('Y-m-d') . '.log')),
    ],
];

use Carbon\Carbon;
use StGeorgeIPG\Exceptions\ResponseCodes\Exception;
use StGeorgeIPG\Laravel\IPG;
//use StGeorgeIPG\Laravel\Facades\IPG; // Or this

$oneYearAhead = (new Carbon())->addYear();

$amount     = 10.00; // In dollars
$cardNumber = '4111111111111111';
$month      = $oneYearAhead->month;
$year       = $oneYearAhead->year;

$purchaseRequest = IPG::purchase($amount, $cardNumber, $month, $year);

try {
    $purchaseResponse = IPG::execute($purchaseRequest);

    echo 'The charge was successful.' . "\n";
} catch (Exception $ex) {
    echo 'The charge was unsuccessful.' . "\n";
    echo $ex->getMessage() . "\n";

    var_dump($purchaseRequest);
    var_dump($ex->getResponse());
}
config/app.php
IPG_LOG_FILE
config/ipg.php
config/ipg.php
config/ipg.php