This plugin is Mollie payment gateway for Kirby Merx plugin.
- Download the latest release
- Unzip downloaded file
- Copy/paste unzipped folder in your
/site/pluginsfolder
Get API key from Mollie dashboard.
Set apiKey option from config.php like following usage:
/site/config/config.php
<?php
return [
'owebstudio.merx-mollie.apiKey' => 'YOUR_API_KEY'
];You need to enable at least one payment method from Mollie Dashboard.
Enter the Kirby panel with Merx installed. Go to the payment methods section from the settings tab and add a new one. Make sure you type `mollie``` in the value field.
🎉 Done! Now you're ready for first order!
$redirect = $merx->initializePayment([
'paymentMethod' => 'mollie',
'method' => ['creditcard', 'paypal'],
]);
go($redirect);$merx->completePayment():| Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | null | API key for Mollie (required) |
| webhooks | boolean | false | Activates Mollie webhooks to process real-time status updates |
| method | string | array | [] | Choose a specific payment method and your customer will skip the selection screen and is sent directly to the chosen payment method. |
| testmode | boolean | false | Set to true to make payments a test payment. |
| initializePayment | Closure | null | Sets custom initialize payment before payment. Be careful! This is advanced configuration. |
| completePayment | Closure | null | Sets the custom complete method after payment. Be careful! This is advanced configuration. |
All the values can be updated in the config.php file and prefixed with owebstudio.merx-mollie..
Possible values: applepay, bancontact, banktransfer, belfius, creditcard, directdebit, eps, giftcard, giropay, ideal, kbc, mybank, paypal, paysafecard, przelewy24, sofort
<?php
// /site/config/config.php
return [
'owebstudio.merx-mollie' => [
'apiKey' => 'YOUR_API_KEY',
'completePayment' => function ($virtualOrderPage, $data, $payment) {
$status = $payment->status ?? 'failed';
if ($payment->method === 'ideal' && $status !== 'paid') {
throw new Exception([
'httpCode' => 400,
'key' => 'merx.completePayment'
]);
}
if ($status === 'paid') {
$virtualOrderPage->content()->update([
'paymentMethod' => 'mollie:' . $payment->method,
'paymentComplete' => true,
'payedDate' => date('c')
]);
}
return $virtualOrderPage;
},
'initializePayment' => function ($virtualOrderPage, $data) {
$data['redirectUrl'] = 'https://yourshopdomain.com/return';
$data['description'] = 'Order Id # ' . $virtualOrderPage->uid();
return $data;
}
]
];