PHPackages                             paynl/sdk - 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

ActiveLibrary[Payment Processing](/categories/payments)

paynl/sdk
=========

2.2.6(3mo ago)401.6M↓42.2%4910MITPHPCI failing

Since Nov 4Pushed 3mo ago15 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (87)Used By (10)

[![Latest Stable Version](https://camo.githubusercontent.com/4ea947bf29ec0f554cfe57690d2432bd74a53e86dc3fe32e2000c520117ee2c2/68747470733a2f2f706f7365722e707567782e6f72672f7061796e6c2f73646b2f762f737461626c65)](https://packagist.org/packages/paynl/sdk)[![Total Downloads](https://camo.githubusercontent.com/08a14e8dd4aef325fb12b6840a852baf50dd0e215f27be79fed6ab7e2885cf98/68747470733a2f2f706f7365722e707567782e6f72672f7061796e6c2f73646b2f646f776e6c6f616473)](https://packagist.org/packages/paynl/sdk)[![Latest Unstable Version](https://camo.githubusercontent.com/9f0b6a9ac4fb9fbe3343244ed0b44a7f4b2ea360dd960d8d3caca27b0bbe4576/68747470733a2f2f706f7365722e707567782e6f72672f7061796e6c2f73646b2f762f756e737461626c65)](https://packagist.org/packages/paynl/sdk)[![Build Status](https://camo.githubusercontent.com/ee9d68dfef7dee0affc0740c94e1b04cdda03a765552723453e9d9004612c981/68747470733a2f2f7472617669732d63692e6f72672f7061796e6c2f73646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/paynl/sdk)[![Coverage Status](https://camo.githubusercontent.com/c9de9a484689d129a25ea632c1c88a84b0aca7f6eaab31494e70cfa34627b718/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7061796e6c2f73646b2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/paynl/sdk?branch=master)

Pay.nl PHP SDK
==============

[](#paynl-php-sdk)

---

- [Installation](#installation)
- [Installation without composer](#installation-without-composer)
- [Requirements](#requirements)
- [Quick start and examples](#quick-start-and-examples)

---

### Version

[](#version)

This SDK supports the older rest-api version. The newest SDK (based on V3 order api) can be found here:

### Installation

[](#installation)

This SDK uses composer.

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

For more information on how to use/install composer, please visit:

To install the Pay.nl PHP sdk into your project, simply

```
$ composer require paynl/sdk

```

### Installation without composer

[](#installation-without-composer)

If you don't have experience with composer, it is possible to use the SDK without using composer.

You can download the zip on the projects [releases](https://github.com/paynl/sdk/releases) page.

1. Download the package zip (SDKvx.x.x.zip).
2. Unzip the contents of the zip, and upload the vendor directory to your server.
3. In your project, require the file vendor/autoload.php
4. You can now use the SDK in your project

### Requirements

[](#requirements)

The PAY. PHP SDK is tested from PHP version 7.1 up to PHP version 8.2 and requires the PHP cURL extension.

### Quick start and examples

[](#quick-start-and-examples)

Set the configuration

```
require __DIR__ . '/vendor/autoload.php';

# Replace tokenCode apitoken and serviceId with your own.
\Paynl\Config::setTokenCode('AT-####-####');
\Paynl\Config::setApiToken('****************************************');
\Paynl\Config::setServiceId('SL-####-####');
```

Get available payment methods

```
require __DIR__ . '/vendor/autoload.php';

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

$paymentMethods = \Paynl\Paymentmethods::getList();
var_dump($paymentMethods);
```

Start a transaction

```
require __DIR__ . '/vendor/autoload.php';

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

$result = \Paynl\Transaction::start(array(
    # Required
        'amount' => 10.00,
        'returnUrl' => Paynl\Helper::getBaseUrl().'/return.php',

    # Optional
    	'currency' => 'EUR',
        'exchangeUrl' => Paynl\Helper::getBaseUrl().'/exchange.php',
        'paymentMethod' => 10,
        'bank' => 1,
        'description' => 'demo betaling',
        'testmode' => 1,
        'extra1' => 'ext1',
        'extra2' => 'ext2',
        'extra3' => 'ext3',
        'products' => array(
            array(
                'id' => 1,
                'name' => 'een product',
                'price' => 5.00,
                'tax' => 0.87,
                'qty' => 1,
            ),
            array(
                'id' => 2,
                'name' => 'ander product',
                'price' => 5.00,
                'tax' => 0.87,
                'qty' => 1,
            )
        ),
        'language' => 'EN',
        'ipaddress' => '127.0.0.1',
        'invoiceDate' => new DateTime('2016-02-16'),
        'deliveryDate' => new DateTime('2016-06-06'), // in case of tickets for an event, use the event date here
        'enduser' => array(
            'initials' => 'T',
            'lastName' => 'Test',
            'gender' => 'M',
            'birthDate' => new DateTime('1990-01-10'),
            'phoneNumber' => '0612345678',
            'emailAddress' => 'test@test.nl',
        ),
        'address' => array(
            'streetName' => 'Test',
            'houseNumber' => '10',
            'zipCode' => '1234AB',
            'city' => 'Test',
            'country' => 'NL',
        ),
        'invoiceAddress' => array(
            'initials' => 'IT',
            'lastName' => 'ITEST',
            'streetName' => 'Istreet',
            'houseNumber' => '70',
            'zipCode' => '5678CD',
            'city' => 'ITest',
            'country' => 'NL',
        ),
    ));

# Save this transactionid and link it to your order
$transactionId = $result->getTransactionId();

# Redirect the customer to this url to complete the payment
$redirect = $result->getRedirectUrl();
```

On the return page, redirect the user to the thank you page or back to checkout

```
require __DIR__ . '/vendor/autoload.php';

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

$transactionId = $_REQUEST['orderId'];

$transaction = \Paynl\Transaction::status($transactionId);

# Manual transfer transactions are always pending when the user is returned
if( $transaction->isPaid() || $transaction->isPending()) {
   # Redirect to thank you page
} elseif($transaction->isCanceled()) {
   # Redirect back to checkout
}
```

On the exchange script, process the order

```
require __DIR__ . '/vendor/autoload.php';

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

$transactionId = $_REQUEST['order_id'];

$transaction = \Paynl\Transaction::status($transactionId);

if($transaction->isPaid() || $transaction->isAuthorized()) {
    # Process the payment
} elseif($transaction->isCanceled()) {
    # Payment canceled, restock items
}

# Always respond with TRUE|
echo "TRUE| ";

# Optionally you can send a message after TRUE|, you can view these messages in the logs.
# https://admin.pay.nl/logs/payment_state
echo ($transaction->isPaid() || $transaction->isAuthorized())?'Paid':'Not paid';
```

### Failover gateway

[](#failover-gateway)

In the event of an outage, set the failover gateway like this:

```
use Paynl\Config;
use Paynl\Transaction;

require __DIR__ . '/vendor/autoload.php';

Config::setTokenCode('AT-####-####');
Config::setApiToken('****************************************');
Config::setServiceId('SL-####-####');

# Setting Failover gateway (for available cores, call Config::getCores())
Config::setCore( Config::CORE2 );

# Or for SDK versions lower then 1.6.7, use:
Config::setApiBase('https://rest.achterelkebetaling.nl');

$requiredArguments = []; // See: Start a transaction example
$result = Transaction::start($requiredArguments);
```

### Testing

[](#testing)

Please run `vendor/bin/phpunit --bootstrap vendor/autoload.php  tests/` to test the application

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance80

Actively maintained with recent releases

Popularity54

Moderate usage in the ecosystem

Community40

Growing community involvement

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~47 days

Recently: every ~64 days

Total

80

Last Release

104d ago

Major Versions

v1.6.5 → v2.0.02022-05-18

1.6.7 → 2.2.02023-11-14

v1.6.10 → 2.2.52026-01-08

### 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 (134 commits)")[![andypieters](https://avatars.githubusercontent.com/u/6470601?v=4)](https://github.com/andypieters "andypieters (41 commits)")[![kevinverschoor](https://avatars.githubusercontent.com/u/61683999?v=4)](https://github.com/kevinverschoor "kevinverschoor (35 commits)")[![annevelden](https://avatars.githubusercontent.com/u/66354730?v=4)](https://github.com/annevelden "annevelden (11 commits)")[![daan-pay](https://avatars.githubusercontent.com/u/51791834?v=4)](https://github.com/daan-pay "daan-pay (7 commits)")[![BackEndTea](https://avatars.githubusercontent.com/u/14289961?v=4)](https://github.com/BackEndTea "BackEndTea (6 commits)")[![IvoWams](https://avatars.githubusercontent.com/u/6737718?v=4)](https://github.com/IvoWams "IvoWams (6 commits)")[![jstjanssens](https://avatars.githubusercontent.com/u/16099258?v=4)](https://github.com/jstjanssens "jstjanssens (6 commits)")[![michael-pay](https://avatars.githubusercontent.com/u/89395125?v=4)](https://github.com/michael-pay "michael-pay (5 commits)")[![marcelschoolenberg](https://avatars.githubusercontent.com/u/2551879?v=4)](https://github.com/marcelschoolenberg "marcelschoolenberg (4 commits)")[![jornBakery](https://avatars.githubusercontent.com/u/30690954?v=4)](https://github.com/jornBakery "jornBakery (4 commits)")[![blaaat](https://avatars.githubusercontent.com/u/277820?v=4)](https://github.com/blaaat "blaaat (3 commits)")[![TerraSkye](https://avatars.githubusercontent.com/u/5426161?v=4)](https://github.com/TerraSkye "TerraSkye (3 commits)")[![marius-123](https://avatars.githubusercontent.com/u/99418774?v=4)](https://github.com/marius-123 "marius-123 (2 commits)")[![czim](https://avatars.githubusercontent.com/u/11831617?v=4)](https://github.com/czim "czim (2 commits)")[![BBrunekreeft](https://avatars.githubusercontent.com/u/9114578?v=4)](https://github.com/BBrunekreeft "BBrunekreeft (1 commits)")[![manuelderuiter](https://avatars.githubusercontent.com/u/329788?v=4)](https://github.com/manuelderuiter "manuelderuiter (1 commits)")[![patrickkivits](https://avatars.githubusercontent.com/u/727174?v=4)](https://github.com/patrickkivits "patrickkivits (1 commits)")[![Rapid0o](https://avatars.githubusercontent.com/u/2361896?v=4)](https://github.com/Rapid0o "Rapid0o (1 commits)")[![Robertbaelde](https://avatars.githubusercontent.com/u/4356288?v=4)](https://github.com/Robertbaelde "Robertbaelde (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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