Jump to content

Paypal Express County / State

Recommended Posts


I have been here before on this issue and to the best of my knowledge it has never been resolved so i thought i would see if anybody has any new answers

I have 2.3.4bs and Paypal express 5.018

In the UK we ship by county or state, some counties are over seas such as northern Island, some counties are still mainland but incur further shipping costs because of location and the such

Our counties list is exactly as Paypal has their's

All works as it should apart from if the clients Paypal account is a little older they may not have been offered the drop-down list that is presented when they create a new account now

This means that when the API contacts Paypal they may not have anything in the county list so my site states we do not ship to there

I do have messages to explain the situation to the end user but clearly I am losing sales.

I hope I have explained the situation properly, and would appropriate any further advise anybody can offer

It is a problem and wonder how many sales it cost me and would love to resolve it

Kindest regards



Share this post

Link to post
Share on other sites

Hello again

It was suggested that maybe I could use something to second guess a mis-spelt county/state say for example BUCKS instead of Buckinghamshire as would now be listed in Paypal drop-down list

This unfortunately will not work as far as i can see as I having been going through the Paypal logs and in some cases the county/state is not there full stop


(edited out real address with **)


as you can see "region" which should have the county/state name in it is blank, this means my API will not see it as place it can ship to


Edited by DAVID3733


Share this post

Link to post
Share on other sites

Looking through the PayPal logs it appears the only continuity is Postcodes, they all appear to have them

I will start to look at these contributions, I have 2.3.4bs with PHP 5.4 plus if anyone can recommend a particular contrib then please do

I assume a list of postcodes will not be that hard to get, and assume they do not change, at least not the first 3 or 4 front half



Share this post

Link to post
Share on other sites

Just as a update

I am sure there is more than one person with this issue in the UK so going to try to keep this updated

I have looked a few Postcode contributions including the @raiwa has included above

I am going to test a few and install them on test site to see what i think is more suitable

Have a few worries going around in my head but think they are probably unfounded



Share this post

Link to post
Share on other sites

Next Update

Little bit of extra info that might help someone

I had previously set up error message in paypal for people who didnt have a county set up in Paypal express, but i did not realise that does not show unless they come back to your site so if you have it enabled then set to disabled in the store in admin

Now back to the main event

I set up a test site and downloaded http://addons.oscommerce.com/info/4712

I also got a few tips from @Mikepo for the splitting up of the postcode into proper AA99 9AA format which is required, with thee tweaks it works on my installation

But of course it does not end there, all of my old clients have postcodes that are not formatted correctly so had to make amendments to the original database to change them, I also made all of the postcodes UPPER case while i was at it using the following in PHP my admin

update address_book
   set postcode
     = concat(left(entry_postcode 
                  , length(entry_postcode)-3)
             , ' '
             , right(entry_postcode ,3)
 where (position(' ' in entry_postcode) = 0) AND entry_country_id = 222

and then also

UPDATE address_book
SET    entry_postcode = UPPER(entry_postcode)
WHERE  entry_country_id = 222

So now when you create a new account it formats the postcode correctly even if they do not put a space in

The website sorts out the shipping cost for areas that might be in areas outside of the norm such as northern Island.


So you would think every thing is fine and Dandy But..............


Share this post

Link to post
Share on other sites

Two problems have emerged

The first, 

I use a contrib called freeamount, its free shipping for orders within the standard area ie not places like Northern Island which costs more to ship if its over 2 kilos, so i need to see if that can be changed to look at the postcode zones rather that the tax zones which is what it does now

The second 

Paypal Express, if the postcode is not formatted correctly ie AA999AA instead of AA99 9AA (no space before the last 3 as all UK postcodes are) there is currently no structure to change it on the fly to get the shipping, it therefore breaks the shipping cost and it it is not charged, I am also not sure if there is a postcode but not a county what will happen, hopefully it will just rely on the postcode 


These may both be quite easy items to fix although probably out of my comfort zone and its getting very late so going to bed and re-look in the morning


Share this post

Link to post
Share on other sites

I have now finished and have a working situation, and as I hate it when threads do not finish I will summarise everything here to help someone who might be in the same situation as me


I have 2.3.4 BS with PHP 5.4.45

Based in UK, different VAT or TAX to some areas, the Channel Islands

Post small Items out via Royal mail

Larger items out via courier

advertise free shipping on orders over £50 but not in some areas which are charged extra by my shipper such as Highlands, Islands Northern Island or channel islands all areas which come under Royal mail postage as UK


The Initial issue was with PayPal Express, many longer Paypal users have not formatted their address properly, as they must do now if they opened a new account.

 My original shipping setup changed the price for whatever (county or State) the parcel was going to which is not as good as postcodes but hey!, some of areas do not pay Tax (channel Islands) and some cost me more to send to if the parcel is over 2kg (northern Island) and some i ship to free over a certain price.

So I had to use counties/states to narrow down the shipping charges, unfortunately in PayPal (express clients) the county or state might be shortened from say example BUCKS instead of Buckinghamshire or they might not have any county or state listed at all, this as causing lost sales as they will go elsewhere if it's not easy.

I tried a number of things, different shipping modules but as one thing got changed it highlighted something else that would be a issue so below is now how a have it set up now and all appears to be working.


I ship worldwide but most of my business goes to United kingdom and Europe, if someone outside the UK purchases then PayPal is not a issue as it uses the country price on my website.

United Kingdom Consists of

Most of UK mainland, free shipping of £50, My fixed rates for orders under £50 which i send either by royal mail or courier depending on weight

Highlands - an area within the UK which couriers charge more for and i do not offer free shipping so different rates for this area

Northern Island - this is offshore to UK, I do not offer free shipping, costs by royal mail is same up to 2k but couriers charge more so again different rates

other islands, IOM, IOW Shetlands and so on,  similar to above, royal mail charge the same prices up to 2k but all different rates for couriers

Channel Islands - again similar to above except they do not pay VAT or Tax for our goods



The Only way I could satisfy all of the shipping area requirements, VAT area requirements and PayPal's lack of formatting issues was to use postcodes / zipcodes which are used throughout all of these regions for the shipping quotation.

I tested a few options on my test site, many of gave other issues such as the space in the postcode before the last three characters which some PayPal accounts had and some did not, some had no ability to do free shipping or want to play with my other modules.


The one i ended up with came from @brockleyjohn  if you PM him i am sure he will let you know more information, I think he called it postcode_shipping It is a modified version of a earlier piece of code.
This shipping module works with the UK postcode layout using the first 3 or four characters of the postcode so does not cause a issue with PayPal, it has language files too, quite easy to install for a novice like me, it came with UK postcode list which you can adapt to your own courier requirements.

Because this module could work with price or weight it meant that i could duplicate it, change all of the constants and class in the file and create myself a free shipping module and use the same postcode list in the database to offer free shipping in only the areas i wanted.

So now i have controllable shipping costs for everywhere in the UK including islands


Then the issue was channel islands, my VAT was set up to charge VAT in all of Europe minus the channel islands, I had achieved this by adding all of the countries into a tax zone in location/taxs Tax zones except UK which i added in all counties apart from jersey and Guernsey, this could not work the way it was now set up to use postcodes.


So I ended up getting a PayPal express zone fix from @raiwa again PM him for more details, with this you put uk in tax zone as all zones, then you can configure in admin to exclude certain ID of zones you do not want to charge VAT on, and you can put mis spelling of those few counties in too.


Just to let you know if you hadn't already guessed I am a shop owner not a coder so it was not that difficult, did spend a lot of time testing on a test site as the last thing i wanted was my site down, it did take a few days and evening's but that was because i was in unknown territory, hopefully it will be worth it


Have Fun


Share this post

Link to post
Share on other sites

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