v.chetkov / cloud-payments
用于处理CloudPayments API的库
v1.0.0.1
2018-09-28 22:17 UTC
This package is auto-updated.
Last update: 2024-09-15 03:34:29 UTC
README
用于处理支付服务CloudPayments的API的库
要求
- 最低PHP版本 - 7.1
安装
composer require "v.chetkov/cloud-payments:*"
使用
- 创建配置实例
<?php $config = new Chetkov\CloudPayments\Config( 'user', 'password' );
- 创建门面实例
<?php $cloudPayments = Chetkov\CloudPayments\CloudPaymentsFactory::create($config);
门面包含CloudPayments API中所有可用方法的完整列表(https://cloudpayments.ru/Docs/Api)。
每个方法在输入时都期待接收一个请求类实例,在输出时返回一个Response类实例。
- 创建请求
<?php $subscriptionFindRequest = new Chetkov\CloudPayments\Request\Subscription\Find('test@test.ru');
- 调用方法
<?php $response = $cloudPayments->subscriptionsFind($subscriptionFindRequest);
- 处理响应
<?php if (!$response->isSuccess()) { throw new RuntimeException($response->getMessage()); } $model = $response->getModel(); //do something