This plugin is Mollie payment gateway for Kirby Merx plugin.
Installation
- Download the latest release
- Unzip downloaded file
- Copy/paste unzipped folder in your
/site/plugins
folder
Setup from Panel
Step 1: Get API key
Get API key from Mollie dashboard.
Step 2: Set API key from config
Set apiKey
option from config.php like following usage:
/site/config/config.php
<?php
return [
'owebstudio.merx-mollie.apiKey' => 'YOUR_API_KEY'
];
Step 3: Enable payment methods
You need to enable at least one payment method from Mollie Dashboard.
Step 4: Add payment method
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.
Step 5: Test
:tada: Done! Now you're ready for first order!
Manual checkout
Initialize payment
$redirect = $merx->initializePayment([
'paymentMethod' => 'mollie',
'method' => ['creditcard', 'paypal'],
]);
go($redirect);
Complete payment
$merx->completePayment():
Options
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 method
option values
Possible values: applepay
, bancontact
, banktransfer
, belfius
, creditcard
, directdebit
, eps
, giftcard
, giropay
, ideal
, kbc
, mybank
, paypal
, paysafecard
, przelewy24
, sofort
Sample options
<?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;
}
]
];