• Resolved kitboxdesign

    (@kitboxdesign)


    Hello I have a multilingual e-shop with 2 language versions. I use Translatepress for translating the content.

    My payment provider uses a callback url as this: https://www.example.com/index.php?wc-api=wc_gateway_paytrcheckout

    This url is only used to send information to the payment plugin as I understand. However it doesn’t carry any languge information. So all customers who made payments through this provider gets their confirmation emails in the default language no matter what they choose.

    Is there a parameter we can add to this URL that will carry the language information referring to the language selected by customer.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You should get the language with this code (not tested):

    // Add Shortcode to get TranslatePress language
    add_shortcode ('CurrentLanguageCode', 'dartrax_get_language_code');
    function dartrax_get_language_code() {
    	if( ! class_exists('TRP_Translate_Press') ) return '';
    	global $TRP_LANGUAGE;
    	return $TRP_LANGUAGE;
    }

    Now [CurrentLanguageCode] should resolve to the current locale like “en_US” for Example. It’s up to the payment provider plugin if it allows Shortcodes in the callback url parameter. If not, you should search or ask if there is a filter you could use to alter the url.

    Thread Starter kitboxdesign

    (@kitboxdesign)

    Thank you @dartrax Translatepress should hire you since you are trying to solve all of their support problems ??
    I will try this. One question: I’m using a snippet plugin to add codes to function.php
    Should I add this code there?

    Thread Starter kitboxdesign

    (@kitboxdesign)

    @dartrax I just tried the code but Payment Provider does not seem to be accepting shortcodes on the URL, test transaction stayed in the awaiting payment status once I added the shortcode.

    I will ask them if there’s a way implementing the code. Thanks again.

    Thanks ??
    Try it in your child theme’s functions.php first and add the shortcode on one of your pages just to make sure it will show the current locale. If that works, you can try with the url parameter, and if it still works, try moving it into a snippet.
    But it seems you already done this and it did not work, so you need a way to dynamically change the url, for example with a filter hook – the payment provider should be able to tell you if there is one available.

    Thread Starter kitboxdesign

    (@kitboxdesign)

    @dartrax Thanks. They actually suggested a fix like this: writing a code to get the order language from meta-data of the order and redirecting the callback URL with the correct slug.

    I got the first part “saving the language data” thanks to you ?? now I’m trying to find a way to get the second part working.

    Hello @kitboxdesign,

    Unfortunately, for the time being, we don’t have support for storing and sending the current language to other plugins that need it.

    This is a tracked feature and will be available in the future versions of TranslatePress – but, as there are other features more requested that require prioritization??, I can’t give you a timeframe for when will this be implemented.

    Thank you for understanding.

    Best regards,
    Cristian

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Payment Callback URL problem’ is closed to new replies.