Announcement

Collapse
No announcement yet.

Sending Paypal a country code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sending Paypal a country code

    If you send paypal a country code and it works its a great feature.
    Customers choosing for example 'Germany' as their location are greeted with a paypal page all in German.

    I have had this working fine on my site for about 2 years.. it recently stopped working. I used this code, supplied by actinic on this forum;

    Code:
    my $sCountry = $::g_LocationInfo{INVOICE_COUNTRY_CODE};
    $sCountry =~ s/^GB$/UK/;
    AddPostValues ('&', 'country', $sCountry, $OPTION, $REDIRECT);
    It changes the Actinic country code 'UK' to 'GB' (which is the paypal country code for the UK) and forwards all the other country codes.

    This has worked well, but has broken recently in an odd way.

    Choosing your location as the UK ends up at paypal as USA.. and the other address details dont get through.
    If you choose USA, the state and other address details are not passed over..

    Choosing France, Germany etc all still work fine!!!

    A strange malfunction.
    Does anyone have any idea why this code might no longer be working?
    Arka Tribal Jewellery

    #2
    PS.
    What if I changed the country code from 'UK' to 'GB' in
    Advanced : Locations
    Paypal would be happy but what about the rest of actinic?
    Arka Tribal Jewellery

    Comment


      #3
      I just viewed the source code of the post that gets sent to Paypal...

      and indeed the country is being given the code 'UK'

      it is no longer being changed to 'GB' by the code snippet above in the first post.

      I cant think why this would stop working???

      Believe me it was...
      It was suggested by TraceyG 18mnths ago and has worked since then
      post #22
      http://community.actinic.com/showthr...t=35279&page=2



      Code:
      <FORM NAME="formOCC" METHOD=POST ACTION="https://www.paypal.com/cgi-bin/webscr">
      <INPUT TYPE=HIDDEN NAME="cmd" VALUE="_xclick">
      <INPUT TYPE=HIDDEN NAME="undefined_quantity" VALUE="0">
      <INPUT TYPE=HIDDEN NAME="no_shipping" VALUE="1">
      <INPUT TYPE=HIDDEN NAME="no_note" VALUE="1">
      <INPUT TYPE=HIDDEN NAME="bn" VALUE="SureSolutions.Actinic">
      <INPUT TYPE=HIDDEN NAME="business" VALUE="mark@arka-shop.co.uk">
      <INPUT TYPE=HIDDEN NAME="notify_url" VALUE="http://www.arka-shop.co.uk/cgi-bin/os000001.pl?PATH=%2e%2e%2facatalog%2f&SEQUENCE=3&ACTION=AUTHORIZE_900&CARTID=81Z98Z89Z169A1256595853B6232&ON=TTSW1010014727&TM=0&ACT_POSTPROCESS=1&">
      <INPUT TYPE=HIDDEN NAME="cancel_return" VALUE="http://www.arka-shop.co.uk/cgi-bin/os000001.pl?SEQUENCE=3&ACTION=%3cBack&REFPAGE=http%3a%2f%2fwww%2earka%2dshop%2eco%2euk%2facatalog%2findex%2ehtml&">
      <INPUT TYPE=HIDDEN NAME="return" VALUE="http://www.arka-shop.co.uk/cgi-bin/os000001.pl?SEQUENCE=3&ACTION=Finish&ORDERNUMBER=TTSW1010014727&REFPAGE=http%3a%2f%2fwww%2earka%2dshop%2eco%2euk%2facatalog%2findex%2ehtml&">
      <INPUT TYPE=HIDDEN NAME="invoice" VALUE="TTSW1010014727">
      
      <INPUT TYPE=HIDDEN NAME="item_name" VALUE="TTSW1010014727">
      <INPUT TYPE=HIDDEN NAME="item_number" VALUE="TTSW1010014727">
      <INPUT TYPE=HIDDEN NAME="amount" VALUE="16.60">
      <INPUT TYPE=HIDDEN NAME="currency_code" VALUE="GBP">
      <INPUT TYPE=HIDDEN NAME="last_name" VALUE="test">
      <INPUT TYPE=HIDDEN NAME="address1" VALUE="87 any street">
      <INPUT TYPE=HIDDEN NAME="city" VALUE="London">
      <INPUT TYPE=HIDDEN NAME="zip" VALUE="SW10">
      <INPUT TYPE=HIDDEN NAME="country" VALUE="UK">
      <INPUT TYPE=HIDDEN NAME="night_phone_b" VALUE="123456789">
      <INPUT TYPE=HIDDEN NAME="email" VALUE="test@ukgb.co.uk">
      Arka Tribal Jewellery

      Comment


        #4
        have you upgraded? done a purge and refresh?

        Comment


          #5
          Hi Darren,

          Thanks for the reply.

          Yes I had tried purge and refresh.

          I have now solved the problem, though it has left me doubting my sanity.

          I ran this snippet past a nerdy mate of mine, who pointed out that the 'UK' and 'GB' parts were the wrong way round !!!
          That this snippet would change 'GB' to 'UK' ... and I want it to change 'UK' to 'GB'

          The correct code is;
          Code:
          $sCountry =~ s/^UK$/GB/;
          Now I just changed this and it works now.. but it has left me totally confused, as I was totally sure that this had been working for over a year??
          Oh dear maybe I'm frazzled. I'm off to lie down.


          (I added this to this post a few days later;
          I think I didnt notice the contry code not working because paypal used to default to 'UK' Recently I think this changed to default to 'USA' which is when I noticed it had stopped working... anyway its all sweet now, the paypal fields are now pre-populated when the customer arrives, with the correct country, language, address etc... )
          Arka Tribal Jewellery

          Comment


            #6
            no i ment if you do a purge and refresh or software update then it will overwrite the script mods you have made and you will need to make these changes again

            Comment


              #7
              oh I See..

              Will a 'purge and refresh' wipe out changes made to the OCCpayment files?
              Arka Tribal Jewellery

              Comment


                #8
                im not sure about the payment files but it does with the scripts, an upgrade will change them

                Comment


                  #9
                  Having sorted out the passing of country codes to Paypal..
                  I'm itching to improve it even more.

                  Currently the only country that this doesnt work perfectly for is USA.
                  This is because Actinic send the names of the states as their actual name..

                  For example Alabama gets sent as Alabama...

                  Code:
                  <INPUT TYPE=HIDDEN NAME="state" VALUE="Alabama">
                  but paypal wants this as a two digit code : AL

                  The codes used are here;
                  http://www.usps.com/ncsc/lookups/abb...ns.html#states

                  So is there any code gurus out there who can write a snippet that changes 'Alabama' to 'AL' etc all the way down to 'Wyoming' to 'WY'

                  Something similar to this snippet I got working I imagine;
                  my $sCountry = $::g_LocationInfo{INVOICE_COUNTRY_CODE};
                  $sCountry =~ s/^UK$/BG/;
                  AddPostValues ('&', 'country', $sCountry, $OPTION, $REDIRECT);
                  to be put into the paypal OCC template.
                  BTW... I only mean write it once for Alabama, I'd then copy it down the list..
                  Arka Tribal Jewellery

                  Comment


                    #10
                    Ok, If anyone is interested, I found my own code monkey and this code replaces the Actinic 'state' with the correct paypal state 'code'

                    ie: Alabama becomes AL

                    Code:
                    my $sState = $::InvoiceContact{ADDRESS4};
                    $sState =~ s/^Alabama$/AL/;
                    
                    #AddPostValues ('&', 'state', $::InvoiceContact{ADDRESS4}, $OPTION, $REDIRECT);
                    AddPostValues ('&', 'state', $sState, $OPTION, $REDIRECT);
                    This line needs to be copied for all the states;
                    Code:
                    $sState =~ s/^Alabama$/AL/;
                    Comment out the original 'state' line and add the replacement lines.

                    This works nicely, the country, state, zip, and both address lines are now passed to pre-populate the paypal fields.
                    Arka Tribal Jewellery

                    Comment

                    Working...
                    X