gamemoney / gamemoney-sdk
gamemoney
Installs: 44 358
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 3
Requires
- php: >=7.0
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: >=6.5.5
- symfony/validator: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- php-mock/php-mock-phpunit: >=2.6.0
- phpunit/php-code-coverage: *
- phpunit/phpunit: >=6.5.14
README
Installation
The preferred way to install this extension is through composer.
Either run
composer require gamemoney/gamemoney-sdk
Or add
"gamemoney/gamemoney-sdk": "*"
to the require section of your composer.json
file.
Usage
<?php require_once __DIR__ . '/../vendor/autoload.php'; $project = 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()); }
Configuration examples
Using key stored in file
Using file_get_contents
to get key from file
<?php $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);
Using path in format file://
/keys/gamemoney/project1/priv.key
-- full path to key
<?php $project = 123456; $hmacKey = 'test'; $pathToPrivateKeyFile = 'file:///keys/gamemoney/project1/priv.key'; $privateKeyPass = 'password'; $config = new \Gamemoney\Config($project, $hmacKey, $pathToPrivateKeyFile, $privateKeyPass);
Using key as string
<?php $project = 123456; $hmacKey = 'test'; $privateKey = '-----BEGIN ENCRYPTED PRIVATE KEY----- ... -----END ENCRYPTED PRIVATE KEY-----'; $privateKeyPass = 'password'; $config = new \Gamemoney\Config($project, $hmacKey);