PHP code example of dann95 / g2a-sdk

1. Go to this page and download the library: Download dann95/g2a-sdk 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/ */

    

dann95 / g2a-sdk example snippets




$hash   = '485d733d-7937-414a-8d42-6781397b1c0a';
$mail   = '[email protected]';
$secret = 'pSO_-N%GZDGfpLu!a5qOUnA>T7QqOro?4?z~Lt5u@LKgg>X247PYvZX8gwy~YY=c';
$env    = 'SANDBOX';
$sdk = new \G2A\Sdk(
    $hash,
    $mail,
    $secret,
    $env
);
 

'providers' => [
    // previous providers
     \G2A\Integrations\Laravel\G2aServiceProvider::class,   
    // next providers
]


/**
 * to obtain hash and secret, go to:
 * https://www.test.pay.g2a.com/setting/merchant (in case of SANDBOX)
 * https://www.pay.g2a.com/setting/merchant (in case of PRODUCTION)
 * email is your account e-mail.
 */
return [
    'hash' => '',
    'secret' => '',
    'email' => '',
    'environment' => 'SANDBOX', // SANDBOX || PRODUCTION
];


$sdk = app('G2A');


class FooBarController extends Controller
{
    public function checkout(\G2A\Sdk $sdk)
    {
        dd($sdk);
    }
}
bash
php artisan vendor:publish --tag=g2a