marissen / ecurring-api-php
0.5.0
2020-10-23 07:05 UTC
Requires
- php: >=7.2
- ext-json: *
- composer/ca-bundle: ^1.1
- guzzlehttp/guzzle: ^6.3|^7.0.1
Requires (Dev)
- fzaninotto/faker: ^1.8
- phpro/grumphp: ^0.19.0
- phpstan/phpstan: ^0.12.0
- phpunit/phpunit: ^8.0
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2021-11-01 10:04:04 UTC
README
这是一个非官方库,它提供了 eCurring API 的 PHP 绑定。
此库受 Mollie API for PHP 客户端 的启发。
要求
为了使用此库,您需要
- 一个有效的 eCurring 账户和 API 密钥。
- PHP >= 7.2
安装
composer require mooore/ecurring-api-php
入门
初始化 eCurring 客户端
use Mooore\eCurring\eCurringHttpClient; $client = new eCurringHttpClient(); $client->setApiKey('your_api_key');
创建客户
$customer = $client->customers->create([ 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'example@domain.com' ]);
从客户创建订阅
$customer = $client->customers->get(200); $subscription = $customer->createSubscription(1);
从订阅计划创建订阅
$subscriptionPlan = $client->subscriptionPlans->get(1); $subscription = $subscriptionPlan->createSubscription(200);
获取所有订阅
$customers = $client->customers->page(); do { foreach ($customers as $customer) { if ($subscription->isActive()) { // do something } } } while ($customers = $customers->next());