Even if "PayPal login page language" is set to other than "US" it always redirects to https://www.paypal.com/us/.
I tried it with several languages clearing the cookie of browsers.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

The URL you quote is not hardcoded anywhere in Ubercart, and the lc parameter is sent correctly. If you are in the US, perhaps PayPal is performing geolocation and redirecting you based on your IP address? You should try accessing your site through a proxy server located in another country to see if you are redirected differently there.

chinita7’s picture

@longwave Thanks for your response. I'm actually using it in Japan. I tried all the languages listed in "PayPal login page language" but always redirected to the US version.
The exact URL looks like
https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=Ut8Z3gAK2-u6F...

By the way, Is it difficult to hard-code it instead ? I would like to see if it's paypal side thing or not if possible. Which part of the code should I modify for example to make it to just "JP" ?

chinita7’s picture

I eventually paid somebody to fix this problem and he found out that paypal was taking the country of "Billing information".
As I had removed "Billing information" from the checkout pane it was always redirected to "US".

TR’s picture

Can you provide a patch?

chinita7’s picture

Sorry actually there is no patch for this. I just enable the "billing information" pane and set the country to "JP" and then unset it on checkout page just to hide it.

"Sent address selection" in "PayPal Website Payments Standard settings" we are forced to choose one of two options "Send billing address to PayPal" or "Send shipping address to PayPal" and I guess this option should be removed or something..

longwave’s picture

Version: 6.x-2.9 » 7.x-3.x-dev
Category: support » bug
Status: Postponed (maintainer needs more info) » Active

According to http://blog.brains4all.com/brainblog/archives/2008/04/paypal_language.html this is a limitation in PayPal, if you send a country code as part of the address then PayPal uses this in preference to the language parameter.

However, uc_paypal currently defaults to 'US' if the country is not available for any reason. It seems to make sense to alter uc_paypal to send the store default country by default, and also drop the 'lc' parameter entirely.

longwave’s picture

Status: Active » Needs review
FileSize
574 bytes

This one line patch should ensure that the store default country is used when the billing pane is disabled, instead of defaulting to the US.

longwave’s picture

This patch removes the PayPal language setting entirely, as it doesn't work when we send the country. Instead, it defaults the country to the store country for all PayPal operations.

janton’s picture

but why do we need to send paypal the country? could we not let paypal deside what country to use, because paypal has a well known idee what language to set the checkout page... (as far as i know paypal knows what language to set there checkout)

I now face this problem, because i have a multilanguage website, i get orders from people all around the world but i only have a english and dutch website... but i also have "Billing information" not enabled on checkout page... so i'm looking for a way to break this code out...

For example a French user is now also shown the US page, because my website is only in English and Dutch. But should paypal not be French then?

TR’s picture

Issue summary: View changes

Marked #2310037: Paypal Login Language as a duplicate.

TR’s picture

Version: 7.x-3.x-dev » 8.x-4.x-dev
Jean-Francois’s picture

My observations with localization on Paypal were as follow (with Ubercart 7.x-3.10):

Our place of business is Montreal, where language is French (FR), and country is Canada (CA).

The Ubercart data transmitted to PayPal can be seen in the PayPal pages HTML code (connexion page and payment page):

1) Setting the PayPal Website Payments Standard "Paypal login page language" (admin/store/settings/payment/method/paypal_wps) to FR sends the following code to PayPal: lc=FR

2) And that the address country field, filled by the customer on checkout sends the following code to PayPal: country=CA

This results in the PayPal UI being French as desired, but the customer's address country field on the PayPal payment page is populated with "France"!

PayPal overrides the customer provided country info with the locale code (I suggested to them that this is a problem).

Here is some of the confused code we find further on their pages as a result of this treatment of the cart data:

"geolocation": "CA"…
"ipcountry": "CA"…
"locality": {
___"country": "FR",
___"lang": "fr"…
"merchant_country": "CA"…
"merchant_locale": "FR"…
"currency": "CAD"…
"shipping_address": {
___"country_code": "CA"…
checkoutSessionLocale=FR&checkoutShippingCountry=CA&ipCountry=CA&merchantCountry=CA"…

I've been told by PayPal that in order to have French as language and Canada as country, the cart should send a 4 letters format localization code to distinguish language from country. In our case this would be "fr_CA" for French Canada.

Otherwise, with two letters locale code, my understanding is that the PayPal page defaults to the language support priority 0 of this code. In the case of FR, the 0 priority sets the locale code to "fr_FR", that is French as language, and France as country.

See their table in this PayPal developers info page:
https://developer.paypal.com/docs/classic/api/locale_codes/

Country.....Country Code.....Language Support Priority.....Locale Code
FRANCE.....FR...................0.......................................fr_FR
FRANCE.....FR...................1.......................................en_US
CANADA....CA...................0.......................................en_US
CANADA....CA...................1.......................................fr_CA

Could uc_paypal send an assembled 4 letters locale code, extracting data from the language of the Drupal site UI (set by the customer in his account) and from the address country info provided by the customer on checkout?

liquidcms’s picture

I am not sure if the error here is with PayPal or Ubercart; but pretty sure the issue remains. I also want the country to default to Canada; but it appears to be set by Ubercart's "PayPal login page language"; which makes no sense since language does not equal country.

#12 above sounds like he has found the issue; but no fix. I also want default country to be Canada, but Ubercart has no setting for country; only for language. Language options are US or GB for different versions of English, these set country to match, US and UK respectively. Ubercart needs a separate selector for country.

liquidcms’s picture

tried patch in #7 and #8, neither works to set country to the store country (Canada).

also, in #12, i can confirm this:

Country.....Country Code.....Language Support Priority.....Locale Code
FRANCE.....FR...................0.......................................fr_FR
FRANCE.....FR...................1.......................................en_US
CANADA....CA...................0.......................................en_US
CANADA....CA...................1.......................................fr_CA

but wondering how en_US will set to Canada; perhaps a typo on PayPal's developer page?

eventually i ended up just hacking in this line:
'lc' => 'en_CA',

in the uc_paypal_wps_form function to get this to work (for WPS).

so PP's dev page is incorrect stating en_US for Canada. Also, i think a bigger patch required for Ubercart to put in proper iso codes based on both store country setting (or pulled from order) and language selection.

TR’s picture

Status: Needs review » Needs work

Most of this was covered in #12, but ...

I also want the country to default to Canada; but it appears to be set by Ubercart's "PayPal login page language"; which makes no sense since language does not equal country.

PayPal's API mandates that we send a country code in order to set the PayPal language. So even if it doesn't make sense (and it doesn't), that's what PayPal needs. See https://www.paypal.com/us/smarthelp/article/how-do-i-change-the-default-... :

When using Checkout, you can change the language on the PayPal login page by setting the LOCALECODE to a two-character country code supported by PayPal. You'll find documentation and two-character country codes on the PayPal Developer Portal under the topic PayPal API locale codes.

(emphasis added)

Likewise, see https://developer.paypal.com/docs/classic/api/locale_codes/#supported-lo... :

To determine the locale for the checkout page, PayPal uses the locale code and these other factors:

  1. The shipping address country provided by the merchant in the request.
  2. The country taken from the locale code parameter passed by the merchant.
  3. The country of the currently logged-in user.
  4. The merchant's country.

When this information is not available, PayPal uses these default locales in this order:

  1. en_US
  2. fr_XC
  3. es_XC
  4. zh_XC

So you see even though we provide a locale code, that's only the second priority - the first is the shipping address country provided by the merchant. Again, this is discussed in #12, that this shipping country overrides the "language" setting in the locale code we provide.

And again from https://developer.paypal.com/docs/classic/api/locale_codes/#supported-lo... :

PayPal supports these locales:
Country Country code Language support priority Locale code

  • CANADA CA 0 en_US
  • CANADA CA 1 fr_CA

I don't think en_US is a typo, because it's used for ALL countries when English is a supported language. I think this is just because PayPal's API sucks.

Regardless,

Also, i think a bigger patch required for Ubercart to put in proper iso codes based on both store country setting (or pulled from order) and language selection.

Yes. Can you make that patch and post it here for review? It's not as simple as putting in the proper ISO codes, because that's not what PayPal uses and because the ISO codes are sometimes ignored in favor of other means of determining the locale, as per the above. Likewise, the patch needs to work in the typical case that the Ubercart site only supports one language (this is the Drupal default and by far the most common use case). In that case, there will be no per-user language information to send to PayPal - the only thing available will be the site language and the customer's ship-to country. And even in a site with multiple languages enabled, you can't send an arbitrary ISO code because PayPal doesn't support them all - then what do you do? Does PayPal have a 'reasonable' fallback for unrecognized codes, or does Ubercart need to provide an admin UI to map installed languages to PayPal-supported languages?

Also be aware that the merchant settings on PayPal.com also play a role here. Ubercart *does* have merchant country ship-from setting, and Drupal *does* have a site country setting, but PayPal also has merchant language and country settings which we can't see and which override what we send them in some cases.

TR’s picture

alh’s picture

FileSize
650 bytes

TR asked us to post our comment and patch here.

We experienced a new problem with PayPal Payments Standard not recognizing the country or address details for customers when they wanted to pay by credit card. Ran in a few circles before we worked out a solution with PayPal. We are in Canada so we need to support both English and French customers. The solution we are using now:

For English customers: Set the localization variable "lc" to NULL. Nothing else worked for us. PayPal tells us that this setting for "lc" allows their geolocation system to work and determine the language. This works fine now although it is a bit odd as our VPS is in the US. But no complaints as long as it keeps on working. Country is recognized and the customer details are correctly populated by PayPal.

For French/Canadian customers: We set the localization variable "lc" to "fr_CA". This works perfectly as the country is now recognized as Canada and the language as French with the address fields populated correctly (even with UTF-8 used for characters with accents).

The patch file we are using is enclosed and as recommended by PayPal all 'official' localization codes per the documentation found here are available for selection:

https://developer.paypal.com/docs/classic/api/locale_codes/.

As you can see from the patch, there is localization option of NULL which forces PayPal to use their geolocation algorithm.

Hope this helps.