PHP code example of mooore / ecurring-api-php

1. Go to this page and download the library: Download mooore/ecurring-api-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mooore / ecurring-api-php example snippets


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());
bash
composer