1. Go to this page and download the library: Download kayintveen/laravel-paynl library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Approve a transaction
PayNL::approveTransaction('1234567890X12ab34');
// Decline a transaction
PayNL::declineTransaction('1234567890X12ab34');
// Void a transaction
PayNL::voidTransaction('1234567890X12ab34');
// Capture a transaction
PayNL::captureTransaction('1234567890X12ab34');
$qr = PayNL::getQrCode('1234567890X12ab34');
echo $qr->getQrUrl(); // URL to QR code image
use Kayintveen\LaravelPayNL\PayNL;
class PaymentController extends Controller
{
public function __construct(
protected PayNL $payNL
) {}
public function createPayment()
{
$transaction = $this->payNL->startTransaction([
'amount' => 10.00,
// ...
]);
return redirect($transaction->getRedirectUrl());
}
}
use Kayintveen\LaravelPayNL\Exceptions\PayNLException;
try {
$transaction = PayNL::startTransaction($options);
} catch (PayNLException $e) {
Log::error('Payment failed: ' . $e->getMessage());
return back()->with('error', 'Payment could not be processed');
}