Problem
The Mollie Orders API supports a cancelUrl parameter that enables a cancel-specific workflow: when a customer cancels a payment at Mollie, they are redirected to this URL. This is distinct from the redirect URL — it allows the shop to handle cancellations differently from successful payments (e.g. restoring the checkout state, showing a cancellation message, or offering to retry).
However, the plugin does not include cancelUrl in the API request payload, so the cancel workflow is never triggered. Customers who cancel a payment at Mollie have no clear path back to the checkout. The behavior depends on the payment method, but often results in the customer being stuck or redirected to a generic page.
OroCommerce already provides a failureUrl in PaymentTransaction::getTransactionOptions() that is intended for exactly this purpose — redirecting the customer on payment failure or cancellation. This URL is available but unused.
Reproduction
- Start a checkout with any Mollie payment method
- On the Mollie payment page, cancel the payment
- Observe that there is no proper redirect back to the OroCommerce checkout
Suggested Fix
1. Extract failureUrl from transaction options in MollieDtoMapper::getOrderData()
After building the order DTO, read the failure URL from the payment transaction options and store it in the order metadata:
$transactionOptions = $paymentTransaction->getTransactionOptions();
if (isset($transactionOptions['failureUrl'])) {
$metadata = $orderData->getMetadata();
$metadata['cancelUrl'] = $this->ensureAbsoluteUrl($transactionOptions['failureUrl']);
$orderData->setMetadata($metadata);
}
Note: The URL may be relative; the Mollie API requires absolute URLs.
2. Pass cancelUrl through in ProxyDataProvider::transformOrder()
After building the API payload, extract cancelUrl from metadata and add it as a top-level field:
$metadata = $order->getMetadata();
if (isset($metadata['cancelUrl'])) {
$result['cancelUrl'] = $metadata['cancelUrl'];
}
The metadata is used as a bridge between the mapper layer (which has access to OroCommerce transaction options) and the proxy layer (which builds the final API payload).
References
Environment
- mollie/orocommerce: 6.1.0 (also affects 5.x)
Problem
The Mollie Orders API supports a
cancelUrlparameter that enables a cancel-specific workflow: when a customer cancels a payment at Mollie, they are redirected to this URL. This is distinct from the redirect URL — it allows the shop to handle cancellations differently from successful payments (e.g. restoring the checkout state, showing a cancellation message, or offering to retry).However, the plugin does not include
cancelUrlin the API request payload, so the cancel workflow is never triggered. Customers who cancel a payment at Mollie have no clear path back to the checkout. The behavior depends on the payment method, but often results in the customer being stuck or redirected to a generic page.OroCommerce already provides a
failureUrlinPaymentTransaction::getTransactionOptions()that is intended for exactly this purpose — redirecting the customer on payment failure or cancellation. This URL is available but unused.Reproduction
Suggested Fix
1. Extract
failureUrlfrom transaction options inMollieDtoMapper::getOrderData()After building the order DTO, read the failure URL from the payment transaction options and store it in the order metadata:
Note: The URL may be relative; the Mollie API requires absolute URLs.
2. Pass
cancelUrlthrough inProxyDataProvider::transformOrder()After building the API payload, extract
cancelUrlfrom metadata and add it as a top-level field:The metadata is used as a bridge between the mapper layer (which has access to OroCommerce transaction options) and the proxy layer (which builds the final API payload).
References
Environment