PHP code example of gamemoney / gamemoney-sdk

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

    

gamemoney / gamemoney-sdk example snippets




ect = 123456;
$hmacKey = 'test';

try {
    $config = new \Gamemoney\Config($project, $hmacKey);
    $gateway = new \Gamemoney\Gateway($config);
    $requestFactory = new \Gamemoney\Request\RequestFactory;
    $request = $requestFactory->getInvoiceStatus(1);
    $response = $gateway->send($request);

    var_dump($response);
} catch (\Gamemoney\Exception\RequestValidationException $e) {
    var_dump($e->getMessage(), $e->getErrors());
} catch (\Gamemoney\Exception\GamemoneyExceptionInterface $e) {
    var_dump($e->getMessage());
}



$pathToPrivateKeyFile = '/keys/gamemoney/project1/priv.key';

$project = 123456;
$hmacKey = 'test';
$privateKey = file_get_contents($pathToPrivateKeyFile);
$privateKeyPass = 'password';

$config = new \Gamemoney\Config($project, $hmacKey, $privateKey, $privateKeyPass);



$project = 123456;
$hmacKey = 'test';
$pathToPrivateKeyFile = 'file:///keys/gamemoney/project1/priv.key';
$privateKeyPass = 'password';

$config = new \Gamemoney\Config($project, $hmacKey, $pathToPrivateKeyFile, $privateKeyPass);



$project = 123456;
$hmacKey = 'test';
$privateKey = '-----BEGIN ENCRYPTED PRIVATE KEY-----
...
-----END ENCRYPTED PRIVATE KEY-----';
$privateKeyPass = 'password';

$config = new \Gamemoney\Config($project, $hmacKey);