Jump to content

[Solved}Paypal Express Checkout Error? - The Field Shipping Address State Is Required


iloveyou-shop

Recommended Posts

Hi

I have reset up my store again with Hostgator..

When I try to pay my testing product with express checkout, at the final stage 'I confirm my order', I receive this error..

 

 

Please try to contact the merchant:

PayPal response:

TIMESTAMP -> 2013-02-14T08:31:38Z

L_ERRORCODE0 -> 10729

L_SHORTMESSAGE0 -> Shipping Address State Empty

L_LONGMESSAGE0 -> The field Shipping Address State is required

L_SEVERITYCODE0 -> Error

 

My address on paypal is australian address and I have enabled Australia in back office already...

 

I did some research and still not yet find an answer...

 

Anyone knows what is going on?

 

Prestashop 1.5.3

Paypal 3.4.5

Link to comment
Share on other sites

Hi,

 

You encounter this error when you enable a country that use states but you don't download the associated localization pack.

In example, you have enabled Australia in you BO, but australian addresses have a state field. If you don't download the Australian localization pack your customers will not be able to select the state for their address, and PayPal will show you this error.

 

To resolve this issue, you just have to download all of the localization packs associated to all of the countries enabled in your BO.

 

Regards.

Link to comment
Share on other sites

I have looked into it more..

 

Customers can check out if they log in and have their address fully filled in on my shop but they encounter trouble when they use express checkout.

 

 

http://forge.prestashop.com/browse/PNM-655

 

"I encounter the same problem. The thing is it only happens when address is copied from Paypal (address is called Paypal_Address). It seems that shop doesn't copy state and then it throws error that state is not given.

How can state check be disabled? This will save from this error."

Hope someone can help out..

Edited by iloveyou-shop (see edit history)
Link to comment
Share on other sites

The problem affects Internet Exploder, a.k.a. IE, a.k.a. "the browser formerly known as IE", a.k.a. Microsoft Internet Explorer. It only affects IE as my customers have reported and I've reproduced.

 

We're running a custom-flavor of Prestashop 1.5.1 but from what I've seen it affects other versions, not sure how many.

 

To reproduce the bug perform a checkout using "the browser formerly known as IE". Checkout as a guest in such a way as to have the "quick-order" screen rendered. A JavaScript error will be thrown and the state dropdown will be blank. IE will complain "console is undefined". A workaround for this issue is to have the customer register and set their State in the account/address screen.

 

This is caused by a bug in JavaScript code. This patch fixes it and we've tested it in on our v1.5.1 site:

 

/themes/default/js/tools/statesManagement.js : line 36

---------------------------------------------------------------------

was:

console.log($('select#id_state'+(suffix !== undefined ? '_'+suffix : '')+' option:not(:first-child)'));

 

should be:

if (typeof(console) !== "undefined" && console.log) { console.log($('select#id_state'+(suffix !== undefined ? '_'+suffix : '')+' option:not(:first-child)')); }

 

 

Also, if you are using a custom theme, then you will want to change the file /themes/[MY_CUSTOMER_THEME_NAME]/js/tools/statesManagement.js

Edited by TWFree (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

I have solved the problem, change some lines on modules\paypal\express_checkout\process.php

 

PAYPAL VERSION : 3.4.5

LINE 243

 

private function setShippingAddress(&$fields, $id_address)
{
 $address = new Address($id_address);
 $fields['ADDROVERRIDE'] = '1';
 $fields['PAYMENTREQUEST_0_SHIPTOSTREET'] = $address->address1;
 $fields['PAYMENTREQUEST_0_SHIPTOSTREET2'] = $address->address2;
 $fields['PAYMENTREQUEST_0_SHIPTOCITY'] = $address->city;
 if ($address->id_state)
 {
  $state = new State((int)$address->id_state);
  $fields['PAYMENTREQUEST_0_SHIPTOSTATE'] = $state->iso_code;
 }
 $country = new Country((int)$address->id_country);
 $fields['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $country->iso_code;
 $fields['PAYMENTREQUEST_0_SHIPTOZIP'] = $address->postcode;
}

 

REPLACE WITH

private function setShippingAddress(&$fields, $id_address)
{
 $address = new Address($id_address);
 $fields['ADDROVERRIDE'] = '1';
 $fields['PAYMENTREQUEST_0_SHIPTOSTREET'] = $address->address1;
 $fields['PAYMENTREQUEST_0_SHIPTOSTREET2'] = $address->address2;
 $fields['PAYMENTREQUEST_0_SHIPTOCITY'] = $address->city;
 $country = new Country((int)$address->id_country);
 $fields['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $country->iso_code;

 if ($address->id_state)
 {
  $state = new State((int)$address->id_state);
  $fields['PAYMENTREQUEST_0_SHIPTOSTATE'] = $state->iso_code;
 } else {
  $fields['PAYMENTREQUEST_0_SHIPTOSTATE'] = $country->iso_code;
 }

 $fields['PAYMENTREQUEST_0_SHIPTOZIP'] = $address->postcode;
}

 

Conclusion: If no ISO state defined, assign Country ISO code on State ISO code

Edited by dwilden (see edit history)
  • Like 3
Link to comment
Share on other sites

I'm having the same problem. I can not allow it to accept payments without the state because without the state then sales taxes will not be applied to residents of Louisiana, so I'll be losing 4% of profits for local customers when profit margins are already extremely tight in some cases.

 

I've lost four customers to this error so far and I'm ready to trash the whole joke of a program known as PrestaShop. It's been a massive fight every step of the way and if I can't get things figured out soon I'm going to be forced to scrap the last three months of work building and populating the website to start from scratch with a new platform.

 

I ONLY allow sales inside the USA.

Only with the US dollar.

All the US states have been loaded and set up properly.

Error has been replicated on Apple and Windows platforms using Safari, Firefox, and Chrome.

 

Can someone please help me out? I'm trying to grow this business but I can't do that when I can't even accept a payment.

 

post-452505-0-00628000-1362722285_thumb.png

Link to comment
Share on other sites

TWFree, of course, this small patch work for all countries.

This problem is not caused by IE, this problem is on all internet browsers.

 

This patch, takes the ISO Country instead of ISO State, if the ISO State is not present.

 

This work only for express mode.

 

I have this patch some weeks on my store applied.

Edited by dwilden (see edit history)
Link to comment
Share on other sites

TWFree, of course, this small patch work for all countries.

This problem is not caused by IE, this problem is on all internet browsers.

 

This patch, takes the ISO Country instead of ISO State, if the ISO State is not present.

 

This work only for express mode.

 

I have this patch some weeks on my store applied.

 

does the patch work for non express mode... meaning will it break the non express mode or allow it to function. Thanks.

Link to comment
Share on other sites

  • 1 month later...

Once again I stand by my patch, it should be consumed into the "main trunk". However I didn't know about the problem also occurring with int'l orders, so it wasn't tested for that; and I'm confident it won't affect that: neither fix it nor make it worse.

 

@dwilden -- here's why your patch doesn't make sense: isn't the problem caused by, somehow, a blank/missing state is passed to modules\paypal\express_checkout\process.php? Or wait...are you saying just ignore _blank_ provinces for int'l orders when posting the data to PayPal, it just happens to work?

 

NOTE: actually @fGaliard already answered the (a) way the state can become blank for int'l orders; which is cited at http://forge.prestashop.com/browse/PNM-655.

Edited by TWFree (see edit history)
Link to comment
Share on other sites

Hi dwilden,

I tried the patch with paypal to pay and ship in Thailand both by paypal account and credit card via paypal system. It's working very fine in expess checkout. I think this is very much help to solve my problem now. So I can use the express check out to run my store.

Thank you very much for your patch. :))

 

P.S. I applied it with paypal version 3.4.8.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

The problem is not solved yet,

I installed the shop on 6-21, the paypal module is already the latest with line 97 added

+ $address->id_state=(int)State::getIdByIso($ppec->result['SHIPTOSTATE'], $address->id_country);

 

paypal module Setting

Express Checkout shortcut

Offer your customers a 3-click checkout experience

No

 

Standard 5 step check is selected

USD as default and only currency

 

a customer from thailand trying to order yesterday and prestashop failed with

PayPal response:TIMESTAMP -> 2013-07-05T04:25:44ZL_ERRORCODE0 -> 10729L_SHORTMESSAGE0 -> Shipping Address State EmptyL_LONGMESSAGE0 -> The field Shipping Address State is requiredL_SEVERITYCODE0 -> Error

Edited by wizard1238 (see edit history)
Link to comment
Share on other sites

The problem is not solved yet,

I installed the shop on 6-21, the paypal module is already the latest with line 97 added

+ $address->id_state=(int)State::getIdByIso($ppec->result['SHIPTOSTATE'], $address->id_country);

 

paypal module Setting

Express Checkout shortcut

Offer your customers a 3-click checkout experience

No

 

Standard 5 step check is selected

USD as default and only currency

 

a customer from thailand trying to order yesterday and prestashop failed with

PayPal response:TIMESTAMP -> 2013-07-05T04:25:44ZL_ERRORCODE0 -> 10729L_SHORTMESSAGE0 -> Shipping Address State EmptyL_LONGMESSAGE0 -> The field Shipping Address State is requiredL_SEVERITYCODE0 -> Error

 

I have exactly same problem. The difference is that shop currency is EUR.

Link to comment
Share on other sites

Is your issue from people clicking the paypal express button or the regular paypal button? Also what countries are the orders being placed from that have the errors?

In my case it was customer from Thailand.

 

added: PS v.1.5.4.1, PayPal 3.5.5

Edited by XJR100 (see edit history)
Link to comment
Share on other sites

Hard to say, it is remote customer, here is what he reported:

 

1. open the web and it's auto [log on set]

2. go to order history

3. push REODER

4. choose next till payment process

log in paypal then ......

 

Please try to contact the merchant:

  1. PayPal response:
  2. TIMESTAMP -> 2013-07-11T05:47:53Z
  3. L_ERRORCODE0 -> 10729
  4. L_SHORTMESSAGE0 -> Shipping Address State Empty
  5. L_LONGMESSAGE0 -> The field Shipping Address State is required
  6. L_SEVERITYCODE0 -> Error

Edited by XJR100 (see edit history)
Link to comment
Share on other sites

Ok, this is what I am thinking, but it could be totally wrong. I am going to have someone at prestashop put me in touch with someone at paypal to ask.

 

But I am thinking that paypal is requiring more countries to have state choices than they used to require. I think prestashop defaultly has like US, CA, and MEX. But it is looking like they might need to be added for other countries too.

 

If you could look at this persons account and see what country they were in that would be helpful.

 

 

But the problem that this thread solved was when people used paypal express, the 3 click button, paypal would send a state back, but prestashop would not accept the state. So for you to fix this, you need to add states to the countries that are having problems.

Link to comment
Share on other sites

I have the same problem in USA where the state iso is already in. If an existing customer login first and them use the paypal express check out it works, but for a new client I get :

1.
PayPal response:

2. TIMESTAMP -> 2013-07-16T07:44:37Z

3. L_ERRORCODE0 -> 10729

4. L_SHORTMESSAGE0 -> Shipping Address State Empty

5. L_LONGMESSAGE0 -> The field Shipping Address State is required

6. L_SEVERITYCODE0 -> Error
Link to comment
Share on other sites

I think it was already installed, here are the code I have:

$address = new Address();

$address->id_country = Country::getByIso($ppec->result['COUNTRYCODE']);

$address->alias = 'Paypal_Address';

$address->lastname = $customer->lastname;

$address->firstname = $customer->firstname;

$address->address1 = $ppec->result['PAYMENTREQUEST_0_SHIPTOSTREET'];

if (isset($ppec->result['PAYMENTREQUEST_0_SHIPTOSTREET2']))

$address->address2 = $ppec->result['PAYMENTREQUEST_0_SHIPTOSTREET2'];

$address->city = $ppec->result['PAYMENTREQUEST_0_SHIPTOCITY'];

$address->id_state = (int)State::getIdByIso($ppec->result['SHIPTOSTATE'], $address->id_country);

$address->postcode = $ppec->result['SHIPTOZIP'];

$address->id_customer = $customer->id;

return $address;

}

Link to comment
Share on other sites

Argentina: also require states...

 

PayPal response:

TIMESTAMP -> 2013-07-27T14:39:37

ZL_ERRORCODE0 -> 10729

L_SHORTMESSAGE0 -> Shipping Address State Empty

L_LONGMESSAGE0 -> The field Shipping Address State is required

L_SEVERITYCODE0 -> Error

 

It looks like a bug...

 

What country will be next?

Link to comment
Share on other sites

It is not so much a bug as that paypal is changing things around on their side. They are supposed to get back at some point and I am going to suggest to Prestashop to add the states by default to the countries that paypal is no requiring them for. But we need to wait until paypal gets back with a list so we can get them all at once.

Link to comment
Share on other sites

Dear all,

 

Regarding to the patch from dwilden on the first page, I got a chance to use the patch again because I played around and updated the paypal to current version 3.5.7 with my prestashop 1.5.4. The patch is still working with one-page checkout which I only use this one since last time. I tried my country Thailand (no state). By using the patch, it seems created "TH" in the address. You can see the captured screen from paypal refund after I tested.

 

PS. Before applying the patch, there is a pop-up screen showing "This address is invalid" for both US and Thai address after entering and clicking save button on the one-page checkout.

 

Cheers,

pptest.jpg

 

More info,

Above is the first time trying, after clearing all caches and the browser history too.

 

2nd time, I tried another prestashop site and tried the mentioned above site, it showed "This address is invalid". It was Thai address and I tried to add more quantity.

 

3rd time, after clearing all caches and browser history. It seemed working fine with Thai address through the paypal payment process.

 

I'm not sure if the patch is stable or not but it is the only way I can use for my store checkout process.

Edited by newbie2PS (see edit history)
Link to comment
Share on other sites

That is what I have too, but I also have Australia, so you might want to go ahead and add that one in.

I see that available update for PayPal : 3.5.7 - should I upgrade current 3.5.5 module and then remove states which ware added to Thailand and some other countries?

Link to comment
Share on other sites

  • 1 month later...

Hey Dh42,

 

I ran into this issue this morning.. Trying your fix using 

 

 

$address->id_state=(int)State::getIdByIso($ppec->result['SHIPTOSTATE'], $address->id_country);

 

To payment.php of the paypal express module.

 

Hoping this fixes this issue. Just came here to say thanks for your help. :) How did a bug like this go unnoticed?

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 4 weeks later...

I'm not sure this is the answer, but I found that it is possible for someone to register without selecting a state. On the registration form I left every field blank and noticed there was a error on ever field except the state when I submitted the form.

 

My remedy  was to add code to check that a state was selected in AuthController.php

 

... code fragment around line 500 in Prestashop version 1.5.6
 
$postcode = Tools::getValue('postcode');
 
// added this to force check for valid state in USA
 
$state_id = Tools::getValue('id_state');
if (((int)$state_id < 1) || ((int)$state_id > 53))
    $this->errors[] = Tools::displayError('You must select a State.');
 
// end added code
 
/* Check zip code format */
if ($country->zip_code_format && !$country->checkZipCode($postcode))
...
 
This may account for the blank state problem with PayPal.
Edited by Fresh BeanZ (see edit history)
Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

Hey inweb,

 

That would be VERY MUCH appreciated. I have been trying to fix this for a long time now and have spent countless hours on it. :( Only persist with Canadian customers at this point with me, although may be other non-US customers as well, not sure.

 

Here is the folder from ~/modules on my live site, is that okay?

paypal.zip

Link to comment
Share on other sites

You all try the new 3.6.7 version which was released today.

 

Hi inweb,

 

Where can i download/update the module?

I am using Prestashop 1.5.6.0 and it came with Paypal 3.6.1 and i do not see an 'update now' button in the modules list.

 

(Am not using express checkout)

 

Thanks

John

Link to comment
Share on other sites

Thanks inweb, have updated the module manually

Tested it and the 'fields' bug appears to be gone.

 

There is just one other issue though, when selecting 'Customer currency' in "Payment module restrictions" , i don't get to see the Paypal icon.

I have 3 currencies in my shop and only by selecting a specific currency in "Currency restrictions" i am able to see the Paypal icon.

 

Is this a bug?

Link to comment
Share on other sites

  • 2 weeks later...

Are you also using PayPal Express?

Hey in web,

 

I'm not sure why I didn't get email notifications on this post! Sorry about the delay. Appreciate you following up.

 

Yes, we are only using 3 step paypal express checkout straight from the shopping cart page (not the product page).

 

Thanks in advance!

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi everyone, I've installed the latest version which is Paypal 3.6.8 and started receiving this error again:

PayPal response:TIMESTAMP -> 2014-05-11T11:45:57ZL_ERRORCODE0 -> 10729L_SHORTMESSAGE0 -> Shipping Address State EmptyL_LONGMESSAGE0 -> The field Shipping Address State is requiredL_SEVERITYCODE0 -> Error

 

So I've remodified the process.php file like said in this thread and we'll see if it's ok.

 

I've tested it with my credit card and it works, but always asks for State in the process. My online shop is Canadian and only sells to Canadians...

 

I've always had these payment problems since I've updated to Prestashop 1.5.6. I wish I never updated.

 

Anyone found a real solution for this?

  • Like 1
Link to comment
Share on other sites

Hey Kyle,

 

I have been searching high and low but have found no real solution to this. It only happens for Canadian customers and via Paypal Express on my shop. 

 

If you do find a solution - that would be AWESOME if you could let me know. 

 

I know there have been some other people posting the same issue, but no one has been able to come up with a solution. :(

  • Like 1
Link to comment
Share on other sites

Hey Kyle,

 

I have been searching high and low but have found no real solution to this. It only happens for Canadian customers and via Paypal Express on my shop. 

 

If you do find a solution - that would be AWESOME if you could let me know. 

 

I know there have been some other people posting the same issue, but no one has been able to come up with a solution. :(

Have you tried this? It's in the first page of this thread:

 

change some lines on modules\paypal\express_checkout\process.php

 

PAYPAL VERSION : 3.4.5

LINE 243

 

private function setShippingAddress(&$fields, $id_address)

{

$address = new Address($id_address);

$fields['ADDROVERRIDE'] = '1';

$fields['PAYMENTREQUEST_0_SHIPTOSTREET'] = $address->address1;

$fields['PAYMENTREQUEST_0_SHIPTOSTREET2'] = $address->address2;

$fields['PAYMENTREQUEST_0_SHIPTOCITY'] = $address->city;

if ($address->id_state)

{

$state = new State((int)$address->id_state);

$fields['PAYMENTREQUEST_0_SHIPTOSTATE'] = $state->iso_code;

}

$country = new Country((int)$address->id_country);

$fields['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $country->iso_code;

$fields['PAYMENTREQUEST_0_SHIPTOZIP'] = $address->postcode;

}

REPLACE WITH

private function setShippingAddress(&$fields, $id_address)

{

$address = new Address($id_address);

$fields['ADDROVERRIDE'] = '1';

$fields['PAYMENTREQUEST_0_SHIPTOSTREET'] = $address->address1;

$fields['PAYMENTREQUEST_0_SHIPTOSTREET2'] = $address->address2;

$fields['PAYMENTREQUEST_0_SHIPTOCITY'] = $address->city;

$country = new Country((int)$address->id_country);

$fields['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $country->iso_code;

 

if ($address->id_state)

{

$state = new State((int)$address->id_state);

$fields['PAYMENTREQUEST_0_SHIPTOSTATE'] = $state->iso_code;

} else {

$fields['PAYMENTREQUEST_0_SHIPTOSTATE'] = $country->iso_code;

}

 

$fields['PAYMENTREQUEST_0_SHIPTOZIP'] = $address->postcode;

}

Link to comment
Share on other sites

  • 1 year later...
  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...