PHP eCurring API client

dev-master 2018-10-25 13:04 UTC


This package provides a simple integration of the Official eCurring for your PHP project.

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version License


With composer, add:

$ composer require laulamanapps/ecurring-api

This package has been created with flexability in mind, you can simply create your own http adapter by implementing the LauLamanApps\eCurring\Http\ClientInterface

Don't wanna do the hassle? make use of the provided Guzzle adapter: require guzzlehttp in your composer:

$ composer require guzzlehttp/guzzle

Get Access Token

Sign up at eCurring and get yourself an api key


Create new Customer

use LauLamanApps\eCurring\eCurringClientFactory;
use LauLamanApps\eCurring\Resource\Customer;
use LauLamanApps\eCurring\Resource\Transaction\PaymentMethod;

$client = eCurringClientFactory::create('<ApiKey>');

$customer = Customer::new(
    'L Skywalker',

$customer = $client->createCustomer($customer);

Add Customer to subscription

use LauLamanApps\eCurring\eCurringClientFactory;
use LauLamanApps\eCurring\Resource\Subscription;
use LauLamanApps\eCurring\Resource\Subscription\Mandate;

$client = eCurringClientFactory::create('<ApiKey>');

$customer = $client->getCustomer(1);
$subscriptionPlan = $client->getSubscriptionPlan(2);

 * Mandate is Optional, if you dont provide it eCurring wil create a
 * mandate for you and the customer can accept the mandate via eCurring
 * see
$mandate = new Mandate(
    new DateTimeImmutable('2018-10-16')

$subscription = Subscription::new(

$subscription = $client->createSubscription($subscription);

Create Payment for subscription

use LauLamanApps\eCurring\eCurringClientFactory;
use LauLamanApps\eCurring\Resource\Transaction;
use Money\Money;

$client = eCurringClientFactory::create('<ApiKey>');

$subscription = $client->getSubscription(1);

$transaction = Transaction::new(
    new DateTimeImmutable('2018-11-20')

$transaction = $client->createTransaction($transaction);

List Customers and iterate over them

use LauLamanApps\eCurring\eCurringClientFactory;
use LauLamanApps\eCurring\Resource\Curser\Pagination;

$client = eCurringClientFactory::create('<ApiKey>');

$pagination =  new Pagination(2); //-- [optional] Lets start pagination on page 2
$customers = $client->getCustomers($pagination);

$customers->disableAutoload(); //-- just iterate over one page

foreach ($customers as $customer) {
    // Do something with the customer


This package comes with 2 types of tests: Unit and Integration. To run them you can use the make commands in the projects root.

$ make tests-unit
$ make tests-integration


eCurring API has been developed by LauLaman.