ecurring api php
v0.5.0
這是一個非正式的庫,為Ecurring API提供PHP綁定。
ecurring Home | Ecurry API文檔
該庫的靈感來自PHP的Mollie API客戶端。
為了使用此庫,您需要:
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 ' => ' [email protected] '
]);從客戶那裡創建訂閱
$ 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 ());