1. Go to this page and download the library: Download g2a/integration-api-client 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/ */
g2a / integration-api-client example snippets
ig = new \G2A\IntegrationApi\Model\Config(
'[email protected]',
'sandboxapi.g2a.com',
'qdaiciDiyMaTjxMt',
'b0d293f6-e1d2-4629-8264-fd63b5af3207b0d293f6-e1d2-4629-8264-fd63b5af3207'
);
$g2aApiClient = new \G2A\IntegrationApi\Client($config);
ig = new \G2A\IntegrationApi\Model\Config(
'[email protected]',
'sandboxapi.g2a.com',
'qdaiciDiyMaTjxMt',
'b0d293f6-e1d2-4629-8264-fd63b5af3207b0d293f6-e1d2-4629-8264-fd63b5af3207'
);
$g2aApiClient = new \G2A\IntegrationApi\Client($config);
// add an order
$request = new G2A\IntegrationApi\Request\OrderAddRequest($g2aApiClient);
$request
->setProductId('10000037846002')
->setCurrency('USD')
->setMaxPrice(45.12)
->call();
$response = $request->getResponse();
echo 'Order ID: ' . $response->getOrderId() . PHP_EOL;