ecurring api php
v0.5.0
นี่คือห้องสมุดที่ไม่เป็นทางการซึ่งให้การผูก PHP สำหรับ API Ecurring
Ecurring Home | เอกสาร Ecurring API
ห้องสมุดนี้ได้รับแรงบันดาลใจจากไคลเอนต์ Mollie API สำหรับ PHP
ในการใช้ห้องสมุดนี้คุณต้องมี:
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 ());