PHPackages                             paynl/sdk-alliance - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. paynl/sdk-alliance

ActiveLibrary[Payment Processing](/categories/payments)

paynl/sdk-alliance
==================

SDK specifically for alliances to manage sub merchants

v2.1.1(2y ago)352.0k↓28.7%9[6 issues](https://github.com/paynl/sdk-alliance/issues)PHP

Since Feb 9Pushed 1y ago9 watchersCompare

[ Source](https://github.com/paynl/sdk-alliance)[ Packagist](https://packagist.org/packages/paynl/sdk-alliance)[ RSS](/packages/paynl-sdk-alliance/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (13)Used By (0)

[![](https://camo.githubusercontent.com/5ab3920c731f81d9a9a300e265f9bbaa300171aba0e9762956deeb20e3a2bb8d/68747470733a2f2f7777772e7061792e6e6c2f68756266732f32353735383235302f696d616765732f5061792532304c6f676f2532302d2532305247425f5072696d6172792532304c6f676f2e706e673f743d31363538313439393330333330)](https://camo.githubusercontent.com/5ab3920c731f81d9a9a300e265f9bbaa300171aba0e9762956deeb20e3a2bb8d/68747470733a2f2f7777772e7061792e6e6c2f68756266732f32353735383235302f696d616765732f5061792532304c6f676f2532302d2532305247425f5072696d6172792532304c6f676f2e706e673f743d31363538313439393330333330)

SDK-Alliance (PHP)
==================

[](#sdk-alliance-php)

---

- [About](#about)
- [Installation](#installation)
- [Setting up](#setting-up)
    - [1. The autoloader](#step-1-the-autoloader)
    - [2. Your API token](#step-2-your-apitoken)
- [Examples](#examples)
    - [1. Adding a merchant](#1-adding-a-merchant)
    - [2. Getting a list of your merchants](#2-getting-a-list-of-your-merchants)
    - [3. Getting a single merchant](#3-getting-a-single-merchant)
    - [4. Uploading a document](#4-uploading-a-document)
    - [5. Getting the list of available categories](#5-getting-the-list-of-available-categories)
    - [6. Adding a service (website)](#6-adding-a-service-website)
    - [7. Getting available payment methods](#7-getting-available-payment-methods)
    - [8. Enable a payment method](#8-enable-a-payment-method)
    - [9. Disable a payment method](#9-disable-a-payment-method)
    - [10. Get statistics of your submerchants](#10-get-statistics-of-your-submerchants)
    - [11. Creating an invoice for a merchant](#11-creating-an-invoice-for-a-merchant)
    - [12. Creating a clearing for a merchant](#12-creating-a-clearing-for-a-merchant)

---

### About

[](#about)

A PAY. alliance account is required for this SDK.

As an alliance, you're able to manage sub-merchants and most of their tasks using this SDK.

This SDK also extends the standard [PAY. SDK](https://github.com/paynl/sdk), so all functions from the original SDK are also available.

### Installation

[](#installation)

This SDK uses composer. To install the PAY. PHP SDK-alliance into your project, simply

```
$ composer require paynl/sdk-alliance

```

### Setting up

[](#setting-up)

To communicate with PAY. using this SDK, you'll need to authenticate. PAY. uses a token to authenticate you. You can find your token in the PAY. admin. On the bottom of the [API Tokens](https://admin.pay.nl/company/tokens) page.

##### Step 1 The autoloader

[](#step-1-the-autoloader)

Composer generates an autoloader for your application. To be able to access the classes of the SDK, all you have to do is include the composer autoloader. The autoloader is located here: vendor/autoload.php

```
require_once('path_to/vendor/autoload.php');
```

##### Step 2 Your APItoken

[](#step-2-your-apitoken)

To let the SDK know what your API-Token is, you'll have to register the TokenCode (AT-code belonging to the token) and APItoken as follows:

```
\Paynl\Config::setTokenCode('AT-####-####');
\Paynl\Config::setApiToken('****************************************');
```

Now you're ready to use the SDK.

### Examples

[](#examples)

The full list of functions can be found in the [samples](https://github.com/paynl/sdk-alliance/tree/master/samples) folder.

##### 1. Adding a merchant

[](#1-adding-a-merchant)

Before we can do anything, we need to add a merchant to work with. For a full example of the merchantData, please refer to the [sample](https://github.com/paynl/sdk-alliance/blob/master/samples/addMerchant.php)

```
$merchant = \Paynl\Alliance\Merchant::add((array)$merchantData);

/*
 *  Save the merchantId to your database.
 *  You'll need this id in the next call
 */
$merchantId = $merchant->getMerchantId();
```

##### 2. Getting a list of your merchants

[](#2-getting-a-list-of-your-merchants)

You can get a list of all your sub-merchants. See the example [here](https://github.com/paynl/sdk-alliance/blob/master/samples/getMerchants.php)

Just call:

```
/*
 * Possible states are: new, accepted, deleted.
 * You can omit this value to get all merchants
 */
$result = Paynl\Alliance\Merchant::getList(array('state' => 'new'));
$merchants = $result->getMerchants();

foreach ($merchants as $merchant) {
    echo $merchant->getMerchantId() . ' ' . $merchant->getMerchantName() . "";
}
```

##### 3. Getting a single merchant

[](#3-getting-a-single-merchant)

You can of course also get the details of a single merchant. See also this [example](https://github.com/paynl/sdk-alliance/blob/master/samples/getMerchant.php).

```
$merchant = Paynl\Alliance\Merchant::get(array('merchantId' => 'M-1820-9300'));

# Documents that still need to be uploaded (for the next example)
$documents = $merchant->getMissingDocuments();

var_dump($documents);
```

##### 4. Uploading a document

[](#4-uploading-a-document)

Before we can accept your sub-merchants, you need to supply the required documents To check the missing documents, see the code from example 3. You can also check the [example](https://github.com/paynl/sdk-alliance/blob/master/samples/uploadDocument.php)

```
$result = Paynl\Alliance\Document::upload(array(
      'documentId' => 'D-####-####',
      'path' => '/path/to/the/file',
      'filename' => 'bankStatement.pdf' # Optional, when you leave this blank, the filename from the path will be used
	));

if ($result->success()) {
}
```

It is also possible to send multiple files. The files will be merged into one file on our server. Both files must be of the same type (pdf or image)

```
$result = Paynl\Alliance\Document::upload(array(
      'documentId' => 'D-####-####',
      'path' => array('/path/to/the/file', 'path/to/the/second/file'),
      'filename' => 'bankStatement.pdf' # Optional, when you leave this blank, the filename from the path will be used
	));

if ($result->success()) {
}
```

##### 5. Getting the list of available categories

[](#5-getting-the-list-of-available-categories)

You must select the correct category for the services you add for the merchant. The available paymentmethods differ for each category (for example, a wine giftcard is only valid for category wines) To get the list of categories, just call [example](https://github.com/paynl/sdk-alliance/blob/master/samples/getCategories.php)

```
$categories = Paynl\Alliance\Service::getCategories();
$data = $categories->getData();

var_dump($data);
```

##### 6. Adding a service (website)

[](#6-adding-a-service-website)

In order for a merchant to use our services, The merchant needs to have a service (website) registered. A merchant can have multiple services, normally one for each website. Before we can add the website, we have to find out in which category the website should be placed. Some paymentmethods are only available for certain categories, so it is important to select the right one. To get a list of the available categories, see step 5. You can also check this [extended example](https://github.com/paynl/sdk-alliance/blob/master/samples/addService.php)

```
$result = Paynl\Alliance\Service::add(array(
    'merchantId' => 'M-####-####',
    'name' => 'The name of my sales location tells us what my Sales location is about',
    'description' => 'This description describes what people are paying for',
    'categoryId' => 'CY-####-####', # Use Paynl\Alliance\Service::getCategories() to get the list of available categories
    'url' => 'https://www.pay.nl',
    'extraUrls' => array(
        'https://phpsdk.webshop.pay.nl',
        'https://sdkalliance.webshop.pay.nl'
    ),
    'alwaysSendExchange' => true # Set to false if you only want a notification on successfull payment (not recommended)
));
```

##### 7. Getting available payment methods

[](#7-getting-available-payment-methods)

To get a list of the available payment methods, see the following [example](https://github.com/paynl/sdk-alliance/blob/master/samples/getAvailablePaymentMethods.php)

```
$paymentOptions = Paynl\Alliance\Service::getAvailablePaymentMethods(array('serviceId' => 'SL-####-####'));
$data = $paymentOptions->getData();

var_dump($data);
```

To get a list of the enabled payment methods, use the Paymentmethods::getList() from the [Merchant SDK](https://github.com/paynl/sdk/blob/master/samples/transaction/paymentMethods.php)

```
\Paynl\Config::setServiceId('SL-####-####');
$paymentMethods = \Paynl\Paymentmethods::getList();
var_dump($paymentMethods);
```

##### 8. Enable a payment method

[](#8-enable-a-payment-method)

To enable a payment method, see the following [example](https://github.com/paynl/sdk-alliance/blob/master/samples/enablePaymentMethod.php)Some payment method have settings. The Paynl\\Alliance\\Service::getAvailablePaymentMethods result has a settings array inside the result for payment methods that have settings.

```
$success = Paynl\Alliance\Service::enablePaymentMethod(array(
    'serviceId' => 'SL-####-####',
    'paymentMethodId' => 739,
    'settings' => array( # Optional for payment methods that have settings.
        'merchantId' => 1234,
        'merchantPassword' => 'p4ssw0rd',
        'portefeuilleId' => '1'
    )
));

if($success) {
    # Enabled
}
```

##### 9. Disable a payment method

[](#9-disable-a-payment-method)

To disble a payment method, see the following [example](https://github.com/paynl/sdk-alliance/blob/master/samples/disablePaymentMethod.php)

```
$success = Paynl\Alliance\Service::disablePaymentMethod(array(
    'serviceId' => 'SL-####-####',
    'paymentMethodId' => 739
));

if($success) {
   # Disabled
}
```

##### 10. Get statistics of your submerchants

[](#10-get-statistics-of-your-submerchants)

You can get the statistics of your submerchants. For example to calculate the amount for the invoice in the next step. See the following [example](https://github.com/paynl/sdk-alliance/blob/master/samples/getStatistics.php)

You can use the predefined periods:

```
\Paynl\Alliance\Statistics::PERIOD_THIS_WEEK
\Paynl\Alliance\Statistics::PERIOD_LAST_WEEK
\Paynl\Alliance\Statistics::PERIOD_THIS_MONTH
\Paynl\Alliance\Statistics::PERIOD_LAST_MONTH
```

For example:

```
$result = Paynl\Alliance\Statistics::getStats(array(
    'period' => \Paynl\Alliance\Statistics::PERIOD_LAST_WEEK
));
var_dump($result->getData());
```

Or if you want to use your own start and end date:

```
$result = Paynl\Alliance\Statistics::getStats(array(
    'startDate' => new DateTime('2015-03-01'),
    'endDate' => new DateTime('2015-03-10')
));
var_dump($result->getData());
```

##### 11. Creating an invoice for a merchant

[](#11-creating-an-invoice-for-a-merchant)

You can add an invoice for a merchant. In order to be able to add an invoice to a merchant, you'll have to set the settleBalance option to true, when adding a merchant in [step 1](#1-adding-a-merchant)See the following [example](https://github.com/paynl/sdk-alliance/blob/master/samples/addInvoice.php)

```
\Paynl\Config::setServiceId('SL-####-####');

$result = Paynl\Alliance\Invoice::add(array(

    # Required
    'merchantId' => 'M-####-####', # The id of the merchant
    'serviceId' => 'SL-####-####', # The serviceid (of the Alliance) to book the payment on
    'invoiceId' => 'INV012345',# Your reference number to the invoice
    'amount' => 25.75, # The total amount of the invoice
    'description' => 'Test invoice', # The description of the invoice

    # Optional
    'invoiceUrl' => 'https://url.to.the/invoice.pdf', # The url to the invoice
    'makeYesterday' => true # If the invoice needs to be added in today's clearing, set this to true
    'extra1' => 'free variable 1',
    'extra2' => 'free variable 2',
    'extra3' => 'free variable 3',
    "merchantServiceId": "SL-####-####", # The ServiceId of the submerchant that needs to be invoiced
));

$referenceId = $result->referenceId();
```

##### 12. Creating a clearing for a merchant

[](#12-creating-a-clearing-for-a-merchant)

You can add a clearing for a merchant. The addClearing function should be called after 5:00 am CET, as the daily totals of the clearings are calculated at 4:00 am CET each day. See the following [example](https://github.com/paynl/sdk-alliance/blob/master/samples/addClearing.php)

```
$result = \Paynl\Alliance\Merchant::addClearing(array(

    # Required
    'amount' => '123', # The amount to clear, in cents.

    # Optional
    'merchantId' => 'M-1234-5678', # The id of the merchant
    'contentCategoryId' => 'CT-1234-5678' # The content category Id
));

$referenceId = $result->referenceId();
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance9

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 54.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~289 days

Recently: every ~561 days

Total

11

Last Release

859d ago

Major Versions

v1.2.0 → v2.0.02022-07-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/3de4fdf653f1c9f2fd2fd25bb1ee8c5cfc05051f17a41759099e44fc47f6a089?d=identicon)[paynl](/maintainers/paynl)

![](https://www.gravatar.com/avatar/f040941e94f10c419db66da10a7c26670c7bee48b4e9c6a78700ffd338b539bb?d=identicon)[PAY](/maintainers/PAY)

---

Top Contributors

[![woutse](https://avatars.githubusercontent.com/u/6763638?v=4)](https://github.com/woutse "woutse (49 commits)")[![kevinverschoor](https://avatars.githubusercontent.com/u/61683999?v=4)](https://github.com/kevinverschoor "kevinverschoor (21 commits)")[![jstjanssens](https://avatars.githubusercontent.com/u/16099258?v=4)](https://github.com/jstjanssens "jstjanssens (6 commits)")[![annevelden](https://avatars.githubusercontent.com/u/66354730?v=4)](https://github.com/annevelden "annevelden (6 commits)")[![andypieters](https://avatars.githubusercontent.com/u/6470601?v=4)](https://github.com/andypieters "andypieters (3 commits)")[![escruickshank](https://avatars.githubusercontent.com/u/82592968?v=4)](https://github.com/escruickshank "escruickshank (2 commits)")[![pieterhielkema](https://avatars.githubusercontent.com/u/34714450?v=4)](https://github.com/pieterhielkema "pieterhielkema (1 commits)")[![ssl](https://avatars.githubusercontent.com/u/25695071?v=4)](https://github.com/ssl "ssl (1 commits)")[![Dybo](https://avatars.githubusercontent.com/u/6922433?v=4)](https://github.com/Dybo "Dybo (1 commits)")

### Embed Badge

![Health badge](/badges/paynl-sdk-alliance/health.svg)

```
[![Health](https://phpackages.com/badges/paynl-sdk-alliance/health.svg)](https://phpackages.com/packages/paynl-sdk-alliance)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/braintree

Braintree gateway for Omnipay payment processing library

35558.0k3](/packages/omnipay-braintree)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
