hyperwallet/sdk
最新稳定版本:2.2.6
Composer 安装命令:
composer require hyperwallet/sdk
包简介
A library to manage users, transfer methods and payments through the Hyperwallet API
README 文档
README
Hyperwallet REST SDK
A library to manage users, transfer methods and payments through the Hyperwallet v4 API.
For Hyperwallet v3 API calls, please use the latest SDK version 1.x.x. See [here|https://docs.hyperwallet.com/content/updates/v1/rest-api-v4] to learn about the differences between versions and the update process required to use REST API v4.
Prerequisites
Hyperwallet's PHP server SDK requires at minimum PHP 5.6 and above.
Installation
$ composer require hyperwallet/sdk
Documentation
Documentation is available at http://hyperwallet.github.io/php-sdk.
API Overview
To write an app using the SDK
-
Register for a sandbox account and get your username, password and program token at the Hyperwallet Program Portal.
-
Add dependency
hyperwallet/sdkto yourcomposer.json. -
Create a instance of the Hyperwallet Client (with username, password and program token)
$client = new \Hyperwallet\Hyperwallet("restapiuser@4917301618", "mySecurePassword!", "prg-645fc30d-83ed-476c-a412-32c82738a20e");
-
Start making API calls (e.g. create a user)
$user = new \Hyperwallet\Model\User(); $user ->setClientUserId('test-client-id-1') ->setProfileType(\Hyperwallet\Model\User::PROFILE_TYPE_INDIVIDUAL) ->setFirstName('Daffyd') ->setLastName('y Goliath') ->setEmail('testmail-1@hyperwallet.com') ->setAddressLine1('123 Main Street') ->setCity('Austin') ->setStateProvince('TX') ->setCountry('US') ->setPostalCode('78701'); try { $createdUser = $client->createUser($user); } catch (\Hyperwallet\Exception\HyperwalletException $e) { // Add error handling here }
-
Error Handling The
HyperwalletExceptionhas an array of errors withcode,messageandfielNameproperties to represent a error.try { ... } catch (\Hyperwallet\Exception\HyperwalletException $e) { // var_dump($e->getErrorResponse()); // var_dump($e->getErrorResponse()->getErrors()); foreach ($e->getErrorResponse()->getErrors() as $error) { echo "\n------\n"; echo $error->getFieldName()."\n"; echo $error->getCode()."\n"; echo $error->getMessage()."\n"; } }
Development
Run the tests using phpunit:
$ composer install $ ./vendor/bin/phpunit -v
Reference
License
统计信息
- 总下载量: 502.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-30