Skip to main content

Stripe Checkout: thank you page loses the language

19 minutes ago #100000575 by Alouette00
-- HikaShop version -- : 6.8.1
-- Joomla version -- : 6.2.0
-- PHP version -- : 8.5.12
-- Browser(s) name and version -- : Safari 605.1

Hello,

On a multilingual Joomla site (Japanese by default, English as second language), a customer who pays with Stripe Checkout from the English pages comes back to the thank you page in Japanese. With the bank transfer method, the thank you page stays in English.

Screenshot 1: bank transfer, ordered from the English pages, the thank you page stays in English (/en/ in the URL).
Screenshot 2: Stripe Checkout, ordered from the English pages, the thank you page comes back in Japanese (no language in the URL).

The URLs given to Stripe (success_url and cancel_url in _createCheckoutSession()) and the $endUrl / $cancelUrl of _handleSessionReturn() and _handle3dsReturn() are built as HIKASHOP_LIVE . 'index.php?...' without the language. So the Language Filter plugin of Joomla picks the language from the browser or the default language of the site.

Routing these URLs with the language of the order fixed it on my site. I added this helper:
Code:
private function _langUrl($query, $langTag = '') { if(empty($langTag)) $langTag = \Joomla\CMS\Factory::getLanguage()->getTag(); if(!empty($langTag) && \Joomla\CMS\Language\Multilanguage::isEnabled()) $query .= '&lang=' . $langTag; return \Joomla\CMS\Router\Route::_($query, false, 0, true); }
and used it for $endUrl and $cancelUrl in _handleSessionReturn() and _handle3dsReturn() with $dbOrder->order_lang, and for $cancelUrl in _createCheckoutSession(). After that, the customer comes back in the language of the order, both after paying and after canceling on the Stripe page.

Versions: Joomla 6.2.0, HikaShop Business 6.8.1, Stripe Checkout 1.5.9, PHP 8.5.12.

Thank you.

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum