Doesn't work with WPML
-
A customer gets referred well to the payment page but when he returns from the mollie page the url is missing the language directory aka skili.be/ instead of skili.be/nl/, skili.be/fr/ or skili.be/en/ so i get a 404.
I dont know if this is a seperate issue but when I then manually enter the language directory in the URL it does redirect nicely to the after-payment / order page but the status is ‘pending payment’ instead of ‘paid’ even with various payment methodes
https://www.ads-software.com/plugins/mollie-payments-for-woocommerce/
-
Mollie can’t send your website the payment status because you use an invalid SSL certificate: https://www.ssllabs.com/ssltest/analyze.html?d=skili.be Please fix your certificate.
Do you use a plugin to add the /nl/, /fr/? We use a WooCommerce function to retrieve the return URL. It looks like this won’t add the language suffix.
Can you please tell me which versions of WordPress and WooCommerce you use?
Both Woocommerce and WordPress are the latest version.
Indeed we use WPML for the language suffix. There’s a function provided by WPML to get the url with the suffix. I’ll look it up. Do you know where or how i can replace it then?
Thnx for the fast reply! (stressfull situation atm)
Your website isn’t using HTTPS, but the return and webhook URL’s are using HTTPS. Please check if you have turned on force HTTPS: WooCommerce > Settings > Checkout: Turn off “Force secure checkout / HTTPS”.
I’ve turned off ‘Force HTTPS’ still Payment pending after I manually adjust the URL with language suffix. Where can i find the code that passes the URL so I can add the code for the suffix?
I’ve now fixed the SSL certificate. The plugin i’m using for multilingual functions is WPML a very known and popular plugin. It provides a filter so that
home_url()
orget_home_url()
return the url with the current language appended.
In your plugin there is an example where you use$_SERVER['SERVER_NAME']
to get the base urlwww.skili.be
using the following code I would get the correct url$str = home_url(); $str = preg_replace('#^https?://#', '', $str); //remove https:// or https:// if(substr($str, -1) == '/') { $str = substr($str, 0, -1); } //remove trailing slash
I hope the fix is this simple and you could show me the file(s) where i have to edit your plugin. I need a quick fix atm, i’ll worry about the longterm solution later. Launchtime is ridiculously close..
I checked the logs and no apparent relevant errors. But i’ll keep an eye on it.
when i continue (choose “payed”) on the mollie payment page (test page) it sends me here:
https://www.skili.be/wc-api/mollie_return/?order_id=5461&key=wc_order_55dd1b1bbc6c1
this is a 404when i add /en or /nl like so:
https://www.skili.be/en/wc-api/mollie_return/?order_id=5461&key=wc_order_55dd1b1bbc6c1
it redirects me to:
https://www.skili.be/en/checkout/order-received/5461/?key=wc_order_55dd1b1bbc6c1&utm_nooverride=1
but in the back-end the order is always “payment pending” instead of “payed”.I’m hoping you can help me based on all this info
found this in the logs aswell:
08-26-2015 @ 05:12:40 - mollie_wc_gateway_mistercash: Create payment for order 5466 08-26-2015 @ 05:12:40 - mollie_wc_gateway_mistercash: Payment tr_fU3fzsaWXt (test) created for order 5466 08-26-2015 @ 05:13:27 - Mollie_WC_Plugin::onMollieReturn: Redirect url on return order mollie_wc_gateway_mistercash, order 5466: https://www.skili.be/nl/afronden/order-received/5466?key=wc_order_55dd3cb7eaedd&utm_nooverride=1
I use the following code to generate the return URL: https://github.com/mollie/WooCommerce/blob/master/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstract.php#L694
This will generate a return URL like: https://www.skili.be/wc-api/mollie_return/?order_id=xxxx&key=wc_order_xxxxxxxxx
When the consumer is redirected to this return URL it will call https://github.com/mollie/WooCommerce/blob/master/mollie-payments-for-woocommerce%2Fincludes%2Fmollie%2Fwc%2Fplugin.php#L70 and on line 111 it will ask the correct gateway for the redirect URL (redirect to order received or to shopping cart).
When the payment is not cancelled the plugin will redirect the user to the order received URL. I use the WooCommerce function get_return_url https://github.com/mollie/WooCommerce/blob/master/mollie-payments-for-woocommerce%2Fincludes%2Fmollie%2Fwc%2Fgateway%2Fabstract.php#L495
I will request a WPML developer license so I can test the plugin with WPML and add support for it.
Are you only using WPML to add the language suffix or do you also need an other plugin for this like https://wpml.org/documentation/related-projects/woocommerce-multilingual/ ?
I’m using multiple WPML plugins but I don’t know exactly which does what but WPML does have a “go global”-program for plugin and theme owners.
https://wpml.org/documentation/theme-compatibility/go-global-program/
They’ll work together with you and setup a site with their plugins and yours to work on. Plus I think it’s a nice change since there are many payment plugins who don’t support WPML and one that does had an edge on the competition ;).I’ll have a try at making it compatible and post my findings here
This did the trick in abstact.php line 690
/** * @param WC_Order $order * @return string */ protected function getReturnUrl (WC_Order $order) { $return_url = WC()->api_request_url('mollie_return'); $return_url = str_replace('https://www.skili.be/',home_url(), $return_url); $return_url = str_replace('https://www.skili.be/',home_url('','','https'), $return_url); $return_url = add_query_arg(array( 'order_id' => $order->id, 'key' => $order->order_key, ), $return_url); return $return_url; } /** * @param WC_Order $order * @return string */ protected function getWebhookUrl (WC_Order $order) { $webhook_url = WC()->api_request_url(strtolower(get_class($this))); $webhook_url = str_replace('https://www.skili.be/',home_url(), $webhook_url); $webhook_url = str_replace('https://www.skili.be/',home_url('','','https'), $webhook_url); $webhook_url = add_query_arg(array( 'order_id' => $order->id, 'key' => $order->order_key, ), $webhook_url); return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_webhook_url', $webhook_url, $order); }
Will you include something similar in the next update? else I’ll have to update it again manually. Don’t know how and didn’t have the time to make a child-plugin
I will try and look for a permanent solution.
You can easily fix the webhook URL by implementing the webhook filter described on https://github.com/mollie/WooCommerce/blob/master/development%2Freadme.md#mollie-payments-for-woocommerce_webhook_url. I can at least add a similar filter for the return URL.
Hi,
I have the same problem with my multi-language shop (polylang). If I use the other payment options (check, stripe, Paypal) the problem doesn’t exists. Sure because the language is based on the slug the language on the return page is set to the default language and anything doesn’t work anymore.
So of my payment URL is
https://domeinnaam.nl/en/checkout/
The return URL should be
https://domeinnaam.nl/en/checkout/order-received/793/?key….
If this is fixed anything is fine ??I tried the webhook, but it;s not working:
add_filter('mollie-payments-for-woocommerce_webhook_url', function($webhook_url) { $lang = pll_current_language('slug'); if ($lang != 'nl') { $new_webhook_url = str_replace($_SERVER['HTTP_HOST'], $_SERVER['HTTP_HOST'].'/'.$lang, $webhook_url); } else { $new_webhook_url = $webhook_url; } return $new_webhook_url; });
Hi,
the webhook_url filter works and I checked also the return URL. That method is a bit different (no filter option). Maybe you can change it bit for the next version?
protected function getReturnUrl (WC_Order $order) { $return_url = WC()->api_request_url('mollie_return'); $return_url = add_query_arg(array( 'order_id' => $order->id, 'key' => $order->order_key, ), $return_url); //return $return_url; return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_return_url', $return_url, $order); }
With this modification I can use the add_filter function for both URL’s and any screen/email has got the right language.
Hi,
I also have the same problem on my site with WPML. As I have no experience in using hooks, I am lost.
Also the text to choose the bank is not translatable any more.This means that this update can not be used right now and that I still have to use the older version.
Fixing the WPML option to use /nl and other /languages, and the possibility to translate the text would be really appreciated!Thanks! JP
- The topic ‘Doesn't work with WPML’ is closed to new replies.