-
Notifications
You must be signed in to change notification settings - Fork 4
Migration ‐ PaymentMethods
Wouter Jonker edited this page Jan 27, 2026
·
2 revisions
Install the new PHP SDK via Composer:
composer require paynl/php-sdk
This migration guide is based on the samples available in both the old and the new SDK.
In the old SDK, configuration is loaded via config.php
In the new SDK, configuration is set via the (new) global config/config.global.php
Add the following at the top of your script:
use PayNL\Sdk\Model\Request\ServiceGetConfigRequest;$slCode = 'SL-5261-6001';
$serviceConfig = new ServiceGetConfigRequest($slCode);From
$paymentMethods = \Paynl\Paymentmethods::getList();Into
$serviceGetConfigResponse = $serviceConfig->start();New:
$paymentMethods = $serviceConfig->getPaymentMethods();
foreach ($paymentMethods as $method) {
echo $method->getId() . ' - ';
echo $method->getName() . ' - ';
echo $method->getImage() . ' - ';
echo $method->getMinAmount() . ' - ';
echo $method->getMaxAmount() . ' - ';
echo $method->getDescription() . ' - ';
echo $method->hasOptions() ? 'has options' : 'none';
echo PHP_EOL;
}Note: \Paynl\Error\Error no longer exists in the new SDK.
Old:
catch (\Paynl\Error\Error $e)New:
catch (PayException $e)(optional)
catch (\Exception $e)Old
<?php
require_once 'vendor/autoload.php';
require_once 'config.php';
try {
$paymentMethods = \Paynl\Paymentmethods::getList();
var_dump($paymentMethods);
} catch (\Paynl\Error\Error $e) {
echo "ERROR: " . $e->getMessage();
}New:
<?php
require_once 'vendor/autoload.php';
use PayNL\Sdk\Model\Request\ServiceGetConfigRequest;
try {
$slCode = 'SL-5261-6001';
$serviceConfig = new ServiceGetConfigRequest($slCode);
$serviceGetConfigResponse = $serviceConfig->start();
$paymentMethods = $serviceGetConfigResponse->getPaymentMethods();
foreach ($paymentMethods as $method) {
echo $method->getId() . ' - ';
echo $method->getName() . ' - ';
echo $method->getImage() . ' - ';
echo $method->getMinAmount() . ' - ';
echo $method->getMaxAmount() . ' - ';
echo $method->getDescription() . ' - ';
echo $method->hasOptions() ? 'has options' : 'none';
echo PHP_EOL;
}
} catch (\Paynl\Error\Error $e) {
echo "ERROR: " . $e->getMessage();
}