Skip to content

cancelUrl not passed to Mollie API — customers cannot return to checkout after cancelling payment #56

@powli

Description

@powli

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

  1. Start a checkout with any Mollie payment method
  2. On the Mollie payment page, cancel the payment
  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions