1. Go to this page and download the library: Download quellabs/canvas-payments 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/ */
quellabs / canvas-payments example snippets
use Quellabs\Payments\PaymentRouter;
use Quellabs\Payments\Contracts\PaymentRequest;
use Quellabs\Payments\Contracts\RefundRequest;
class CheckoutService {
public function __construct(private PaymentRouter $router) {}
public function pay(): string {
$response = $this->router->initiate(new PaymentRequest(
paymentModule: 'mollie_ideal',
amount: 999, // in minor units — €9.99
currency: 'EUR',
description: 'Order #12345',
));
if (!$response->success) {
throw new \RuntimeException($response->errorMessage);
}
return $response->redirectUrl;
}
}