2

We built a multicurrency website on Craft Commerce that uses both Euros and Dollars. The base currency is EUR. We use Mollie as payment gateway. However, Mollie only supports Euros on their platform and does not convert other currencies to euros. The conversion has to take place on the website before the user arrives on their platform.

The problem is: when a user checks out on our website with dollars, say 100USD, the amount will show up on Mollie as 100EUR. Obviously this is a big issue as the amounts will be off by several percents.

How do we properly fix this?

2 Answers 2

1

We found a quickfix by editing the Commerce_PaymentsService.php file in craft/plugins/services/.

We changed to following:

$request = [
    'amount'               => $transaction->paymentAmount,
    'currency'             => $transaction->paymentCurrency,
    'transactionId'        => $transaction->id,
    'description'          => Craft::t('Order').' #'.$transaction->orderId,
    'clientIp'             => craft()->request->getIpAddress(),
    'transactionReference' => $transaction->hash,
    'returnUrl'            => UrlHelper::getActionUrl('commerce/payments/completePayment', ['commerceTransactionId' => $transaction->id, 'commerceTransactionHash' => $transaction->hash]),
    'cancelUrl'            => UrlHelper::getSiteUrl($transaction->order->cancelUrl),
];

To:

$request = [
    'amount'               => $transaction->amount,
    'currency'             => $transaction->currency,
    'transactionId'        => $transaction->id,
    'description'          => Craft::t('Order').' #'.$transaction->orderId,
    'clientIp'             => craft()->request->getIpAddress(),
    'transactionReference' => $transaction->hash,
    'returnUrl'            => UrlHelper::getActionUrl('commerce/payments/completePayment', ['commerceTransactionId' => $transaction->id, 'commerceTransactionHash' => $transaction->hash]),
    'cancelUrl'            => UrlHelper::getSiteUrl($transaction->order->cancelUrl),
];

This way the request sends the amount based on the base currency (in our case EUR) to Mollie.

This seems a bit hacky to us so maybe an exception for the Mollie gateway can be added to future updates to Craft Commerce.

1

If you can't charge someone in a certain currency with your gateway, then it shouldn't be selectable as a payment currency option for the order. The feature is called 'multi currencies payments' - it allows your customer to optionally pay the total of the order in a different currency at the conversion rate you specify.

The change you made to charge in the primary currency defeats the purpose of the feature. Set the payment currency to Euros before charging the user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.