gamemoney/gamemoney-sdk
最新稳定版本:v4.1.0
Composer 安装命令:
composer require gamemoney/gamemoney-sdk
包简介
gamemoney
README 文档
README
Installation
The preferred way to install this extension is through composer:
composer require gamemoney/gamemoney-sdk
Usage
<?php require_once __DIR__ . '/../vendor/autoload.php'; $project = 123456; $hmacKey = 'test'; $certificate = '-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----'; try { $config = new \Gamemoney\Config($project, $hmacKey, $certificate); $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'; $certificate = '-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----'; $privateKey = file_get_contents($pathToPrivateKeyFile); $privateKeyPass = 'password'; $config = new \Gamemoney\Config($project, $hmacKey, $certificate, $privateKey, $privateKeyPass);
Using path in format file://
/keys/gamemoney/project1/priv.key -- full path to key
<?php $project = 123456; $hmacKey = 'test'; $certificate = '-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----'; $pathToPrivateKeyFile = 'file:///keys/gamemoney/project1/priv.key'; $privateKeyPass = 'password'; $config = new \Gamemoney\Config($project, $hmacKey, $certificate, $pathToPrivateKeyFile, $privateKeyPass);
Using key as string
<?php $project = 123456; $hmacKey = 'test'; $certificate = '-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----'; $privateKey = '-----BEGIN ENCRYPTED PRIVATE KEY----- ... -----END ENCRYPTED PRIVATE KEY-----'; $privateKeyPass = 'password'; $config = new \Gamemoney\Config($project, $hmacKey, $certificate);
Full Documentation
统计信息
- 总下载量: 65.45k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-13