Easily create payment requests through Tikkie.
Unofficial PHP implementation of the Tikkie API.
PHPTikkie requires PHP 7+
Add this package to your project using Composer:
composer require jarnovanleeuwen/php-tikkie
use PHPTikkie\Environment;
use PHPTikkie\PHPTikkie;
$apiKey = "abc123";
$testMode = true;
$environment = new Environment($apiKey, $testMode);
$environment->loadPrivateKey('private_rsa.pem');
$tikkie = new PHPTikkie($environment);
$platform = $tikkie->newPlatform([
// Mandatory attributes
'name' => 'YourPlatform',
'phoneNumber' => '06123456789',
'platformUsage' => Platform::USAGE_TYPE_MYSELF,
// Optional attributes
'email' => '[email protected]',
'notificationUrl' => ''
])->save();
$platformToken = $platform->platformToken;
$user = $tikkie->newUser($platformToken, [
'name' => 'ExamplePlatform',
'phoneNumber' => '06123456789',
'iban' => 'NL00BANK123456789',
'bankAccountLabel' => 'YourLabel'
])->save();
$userToken = $user->userToken;
$bankAccountToken = $user->bankAccounts[0]->bankAccountToken;
$paymentRequest = $tikkie->newPaymentRequest($platformToken, $userToken, $bankAccountToken, [
// Mandatory attributes
'amountInCents' => '1250',
'currency' => 'EUR',
'description' => 'Thank you',
// Optional attributes
'externalId' => 'Order 1234'
])->save();
$tikkieUrl = $paymentRequest->paymentRequestUrl;
$paymentRequestToken = $paymentRequest->paymentRequestToken;
function paymentRequest(string $platformToken, string $userToken, string $paymentRequestToken): PaymentRequest
function platforms(): Platform[]
function users(string $platformToken): User[]
function paymentRequests(string $platformToken, string $userToken, int $offset, int $limit, DateTimeInterface $fromDate = null, DateTimeInterface $toDate = null): PaymentRequest[]
$paymentRequest = $tikkie->paymentRequest($platformToken, $userToken, $paymentRequestToken);
foreach ($paymentRequest->payments as $payment) {
if ($payment->isPaid()) {
// Payment successful
}
}
All methods may return a PHPTikkieException
containing an error code and description.
use PHPTikkie\Exceptions\PHPTikkieException;
try {
var_dump($tikkie->platforms());
} catch (PHPTikkieException $exception) {
print $exception->getMessage(); // [ERR_2005_002] The API Key is invalid for the requested resource (see https://developer.abnamro.com/get-started#obtaining-an-api-key)
}