PHP code example of owebstudio / merx-mollie
1. Go to this page and download the library: Download owebstudio/merx-mollie 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/ */
owebstudio / merx-mollie example snippets
return [
'owebstudio.merx-mollie.apiKey' => 'YOUR_API_KEY'
];
$redirect = $merx->initializePayment([
'paymentMethod' => 'mollie',
'method' => ['creditcard', 'paypal'],
]);
go($redirect);
$merx->completePayment();
return [
'owebstudio.merx-mollie.webhooks' => false
];
use Kirby\Exception\Exception;
use Oweb\MollieGateway;
// /site/config/config.php
return [
'owebstudio.merx-mollie' => [
'apiKey' => 'YOUR_API_KEY',
'completePayment' => function ($virtualOrderPage, $data, $payment) {
if ($payment->status !== 'paid') {
throw new Exception([
'httpCode' => 400,
'key' => 'merx.completePayment'
]);
}
return MollieGateway::updateOrderPage($virtualOrderPage, [
'paymentMethod' => 'mollie:' . $payment->method,
'paymentComplete' => true,
'paidDate' => date('c')
]);
},
'initializePayment' => function ($virtualOrderPage, $data) {
$data['redirectUrl'] = 'https://yourshopdomain.com/return';
$data['description'] = 'Order Id # ' . $virtualOrderPage->uid();
return $data;
}
]
];