This SDK is an unofficial software with no warranties by G2A PAY ®, you can check more about G2A in: https://www.g2a.com/
- Requirements
- Installation
- Available resources
- Getting started
- Laravel integration
- Project goals/todo
- Contribute
- PHP 7.0 and later.
- Guzzle 6
You can install the sdk via Composer. Run the following command:
composer require dann95/g2a-sdkTo use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');Due some API limitations from G2A, this SDK is restricted to few operations, see the table below to know what this SDK can do. API means that this is available on this SDK
EMAIL means that is only available by e-mail contact
DASHBOARD means that is only available in merchant dashboard
| create | query | refund |
|---|---|---|
| API | API |
| create | cancel | query | refund | list transactions |
|---|---|---|---|---|
| API | DASHBOARD | DASHBOARD | DASHBOARD |
Setting up credentials be like:
$hash = '485d733d-7937-414a-8d42-6781397b1c0a';
$mail = 'merchant@my-test-store.com';
$secret = 'pSO_-N%GZDGfpLu!a5qOUnA>T7QqOro?4?z~Lt5u@LKgg>X247PYvZX8gwy~YY=c';
$env = 'SANDBOX';
$sdk = new \G2A\Sdk(
$hash,
$mail,
$secret,
$env
);
Insert the provider into providers array in config/app.php
'providers' => [
// previous providers
\G2A\Integrations\Laravel\G2aServiceProvider::class,
// next providers
]Then run the following command:
php artisan vendor:publish --tag=g2aEdit the file configs/g2a.php, you will have something like this
prefer use env() helper instead of strings to save your credentials
<?php
/**
* 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
];Now when you do, it will give you a fresh instance of SDK using settings on config/g2a.php:
$sdk = app('G2A');Or, when inside a Controller/any part of Laravel where Auto Dependency Injection is available:
class FooBarController extends Controller
{
public function checkout(\G2A\Sdk $sdk)
{
dd($sdk);
}
}- 100% Unit coverage
- Use abstraction of HttpClient instead of Guzzle
- Do a Legacy version, for php 5.4+
- Full error detailed Exceptions and Entities
- Release first stable version (1.0.0)
Feel free to contribute to this repository.