Forums / PayPal Express Checkout support / PP Express shipping question

PP Express shipping question

Locked

Started by tinypack on 18 Jul 2007, 4:48 PM · Views: 10,138

Results 1 to 20 of 31
This thread is locked. New replies are disabled.
18 Jul 2007, 4:48 PM
#1
tinypack avatar

tinypack

New Zenner

Join Date:
Apr 2007
Location:
Spudville
Posts:
60
Plugin Contributions:
0

PP Express shipping question

I had a situation pop up yesterday and I am not sure how to prevent it in the future. The scenario happened like this:

  1. Customer clicks on regular checkout button and fills out each form in checkout process. In the shipping option, they enter an alternate address from billing.

  2. Customer continues to PayPal where they enter credit card info. In the order review, PayPal has changed the shipping address back to the billing address. The customer did not understand they had to edit the shipping address again and the order goes through without the drop shipping address.

  3. When I viewed the order in Zen-cart, the order details showed the same address for billing and shipping, and I would have had no idea they wanted the item shipped elsewhere.

It would seem the shipping information about the order is not being sent to PayPal, requiring the customer to enter information twice. So either I need to eliminate the regular checkout process and have my customers go directly to PayPal or ?

BTW, I have all the latest updates and patches.

www.PrairieRoses.com
A Country Sensibility

24 Jul 2007, 10:52 PM
#2
tinypack avatar

tinypack

New Zenner

Join Date:
Apr 2007
Location:
Spudville
Posts:
60
Plugin Contributions:
0

Re: PP Express shipping question

I am wondering if the problem lies with the automatic account creation option? I currently have that turned on. Perhaps this option is over-riding the order details in Zen-Cart when it imports a new account. I may turn it off and see what happens.... Although it is a nice feature otherwise.

www.PrairieRoses.com
A Country Sensibility

13 Aug 2007, 11:55 AM
#3
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

Hi tinypack.

Did you ever find an answer to this as I think the same thing has happend to me. How did you find out the shipping address?

My store is located in New Zealand. A customer from the UK placed an order and used PayPal Express checkout through the regular checkout process. The order in Zen Admin lists shipping and billing address as the same address (in the UK) but the customer was only charged for shipping within New Zealand. I know my shipping zones are setup correctly as I have tried checking out with a test account configured for the UK and I get the correct shipping options/prices on Step 1 of checkout process but did not complete the entire transaction.

So basically what I am saying is that either I have the same problem as you or there is some other problem with PayPal Express shipping options.

I need to figure this out quickly as there is a rather big difference in shipping costs between sending something locally and sending to the UK... bye bye profits :censored:

13 Aug 2007, 2:00 PM
#4
tinypack avatar

tinypack

New Zenner

Join Date:
Apr 2007
Location:
Spudville
Posts:
60
Plugin Contributions:
0

Re: PP Express shipping question

I only happened to discover the error because I talked to the customer. I haven't been able to work out the problem other than posting instructions on the checkout pages. Customers really should not have to enter the information twice, but that is how things currently work. I haven't found a setting in my paypal profile or payment module that will allow for drop shipping. My current paypal module settings are:

Enable this Payment Module
True

Sort order of display.
1

Payment Zone
--none--

Set Order Status
Processing [2]

Set Unpaid Order Status
Pending [1]

Set Refund Order Status
Pending [1]

Express Checkout: Require Confirmed Address
No

Express Checkout: Select Cheapest Shipping Automatically
No

Express Checkout: Skip Payment Page
Yes

Express Checkout: Automatic Account Creation
Yes

Payment Action
Auth Only

Transaction Currency
Only USD

www.PrairieRoses.com
A Country Sensibility

14 Aug 2007, 11:27 AM
#5
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

Thanks for getting back to me tinypack.

Yes I agree it is very annoying to expect a customer to enter their shipping address twice and most won't do it (which creates more work for us - if we can even figure out that they changed their shipping address :unsure:).

I took a look at the PP Express Zencart modules code and Paypal's integration documentation (https://www.paypal.com/en_US/pdf/PP_ExpressCheckout_IntegrationGuide.pdf - see the note at the top of page 36) and it looks like it is supposed to work when over-wridden but I am struggling to follow the flow of code in the payment module. I will take another look tomorrow when I am fresh and see if I can see why it isn't working the way it should.

Regards.
Duwane

15 Aug 2007, 5:47 AM
#6
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

Could someone with a fresh install of ZenCart 1.3.7.1 (with the latest PayPal patches from DrByte installed) please test and confirm if the address over-ride is working with PayPal Express checkout? I do not have enough web space left to upload onother copy of ZenCart for testing.

I have done test transactions with my website and it seems like if a user goes through the the standard checkout process and changes the shipping address in step 1 of checkout that the customers address from their PayPal account is being sent back as the shipping address. here is no record in ZenCart that the shipping address is different from the billing address. Taxes as also not calculated correctly, but the shipping costs seem to be correct. In other words it seems like the override I mentioned in the post above is not working and this is confusing ZenCart.

I am still looking over the code but cannot find any problems as yet....:frusty:

15 Aug 2007, 2:18 PM
#7
carlvt88 avatar

carlvt88

Zen Follower

Join Date:
Aug 2007
Location:
Williston, Vermont
Posts:
180
Plugin Contributions:
0

Re: PP Express shipping question

I too am seeing the same problem. First a disclaimer - I'm fairly new to all this. From my digging though, it seems that

  • Registration in zencart goes to the address_book database
  • paypal response comes back with the paypal address as a shipping address:
    Request Parameters: {DoExpressCheckoutPayment} Array (
    [ITEMAMT] => 8.50
    [SHIPPINGAMT] => 1.00
    [AMT] => 9.50
    [L_NUMBER0] =>
    [L_QTY0] => 1
    [L_NAME0] => Ticket - Oct.20 11am Matinee
    [L_AMT0] => 8.50
    [L_TAXAMT0] => 0.00
    [SHIPTONAME] => Test User
    [SHIPTOSTREET] => Paypal billing
  • paypal response goes to the 'orders' shipping_address database
  • zen reports (email verifications, account activity reports, shipping labels, etc.) use the 'orders' database

To me, it would seem that paypal would be concerned with billing, while zen is concerned with shipping, but I'm inexperienced here and I'm only concerning myself with paypal express and I'm not offering any other payment options.

I'm thinking of digging into the code to figure out how to put that paypal response into the orders:billing_address instead of orders:shipping_address, or I might just put lots of comments onto the check-out pages (not ideal).

If anyone can tell me where I'm confused, or if this is a valid bug that can/will be patched, I'd be very grateful.

Thanks,
Carl

15 Aug 2007, 3:00 PM
#8
carlvt88 avatar

carlvt88

Zen Follower

Join Date:
Aug 2007
Location:
Williston, Vermont
Posts:
180
Plugin Contributions:
0

Re: PP Express shipping question

Should have mentioned that I'm at Zencart 1.3.7, I've installed the June 17 paypal patch and reinstalled the module. I'm running a new database as a practice before going live, and I'm in sandbox mode with the paypal developer sandbox.

15 Aug 2007, 8:42 PM
#9
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

Thanks carlvt88.

It seems that this may be a bug somewhere. A customer won't put their address in twice. Some will but they shouldn't be expected to (IMHO). PayPal says (according to their documentation) that you can override the customers PayPal address so it should work.

It might have something to do with our setups which is why I wanted someone with a fresh test install to check this. Preferably someone that knows the PayPal code well (DrByte :cool: pleeeeeze). It may only show up depending on some factors so if we can eliminate any bugs in a clean install then at least we know it is not out setup...

I will continue checking the code but as I said before I can't find anything yet.

15 Aug 2007, 9:04 PM
#10
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

I also forgot to add in support of what we are saying, that most shop owners would not notice this problem unless a customer complained that their goods were shipped to the wrong address. The only reason I noticed this was that my customer happend to be from another country and I could see that the shipping cost did not match what it should have been.

16 Aug 2007, 9:15 AM
#11
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

OK. I have done loads more testing in live mode (my poor credit card :blink:) as Sandbox environment kept coming up with errors and timing out. This is what I have found:

If I check out with a shipping address that is different from my PayPal account address, the address from my PayPal account is written to the database with the order details as the shipping address. This part I knew already. The interesting part is that once the transaction is complete there is a new entry in my address list with the PayPal account details.

This means that ZenCart is allowing the PayPal address sent back to override what the user sets as the shipping address during checkout. This does not seem right. The other interesting thing I noticed is that if you already have 5 entries in your address book, using PayPal Express as the payment method allows you to go over the 5 address limit :huh: I ended up with about 8 entries in my address book when in Zen Admin I have it set to only allow 5 max.

Now I will start looking at how to get ZenCart to ignore the address that PayPal sends back and write the address that the user has specified to the database as the shipping address.

16 Aug 2007, 10:20 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: PP Express shipping question

duwane:

Now I will start looking at how to get ZenCart to ignore the address that PayPal sends back and write the address that the user has specified to the database as the shipping address.

So ... you mean ... when someone (esp not-yet-logged-in) starts Express Checkout, goes to PayPal, and selects (or enters a new) shipping address, you want Zen Cart to ignore that and just use whatever address is their primary ZC address ?

I haven't had a chance to test out all of what you're explaining to see where there's a discrepancy.
However, it should be using the Zen Cart address only if the customer specifically changes their address on the payment page after returning from PayPal.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Aug 2007, 11:32 AM
#13
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

DrByte:

So ... you mean ... when someone (esp not-yet-logged-in) starts Express Checkout, goes to PayPal, and selects (or enters a new) shipping address, you want Zen Cart to ignore that and just use whatever address is their primary ZC address ?

I haven't had a chance to test out all of what you're explaining to see where there's a discrepancy.
However, it should be using the Zen Cart address only if the customer specifically changes their address on the payment page after returning from PayPal.

Thanks for replying DrByte. I agree with you that you can't ignore the address if the user does not have a ZenCart account.

However the problem I am seeing is when the user does have a ZenCart account and goes through the 3 step checkout process. On step one they change the shipping address to something other than their default, select the shipping method and continue. On step 2 they select PayPal Express as the payment option. They go through step 3 and when they come back from PayPal they go straight to checkout success so there is no other chance for them to change the shipping address again and the address entered into the DB against the order is the address PayPal sends back (PayPal account address unless they change it again on the PayPal payment page).

The angle I was working on as a solution was if the user already has a shipping address specified i.e. if(isset($_SESSION['sendto'] then don't let the PayPal address sent back override it. That way if it is a user that does not have an account i.e. !$_SESSION['sendto'] it will still accept the PayPal details as the shipping address for the order.

Will this work or is this what is already supposed to be happening? I am just trying to find a way around this that won't break everything :smile: and avoiding extra instructions for the customer.

17 Aug 2007, 3:14 AM
#14
tinypack avatar

tinypack

New Zenner

Join Date:
Apr 2007
Location:
Spudville
Posts:
60
Plugin Contributions:
0

Re: PP Express shipping question

I received an order today with a different shipping address from billing and the order appeared correctly in Zen-Cart. The customer must have noticed that the ship to address had to be changed in PayPal too.

With my testing, the problem appears when a customer fills out the billing/payment info in PayPal, PayPal automatically fills in the shipping address with the billing address instead of receiving the correct ship to address from zen-cart. I think PayPal prefers to have the billing/ship to address the same. I know this reduces potential fraud, but many of my customers send my items as gifts and this difficulty could cause customer service problems. It also creates double entry work for the customer and it could easily be missed if they aren't paying attention.

I wish I could dive into the code to work this out, but unfortunately my coding skills are pretty messy.

www.PrairieRoses.com
A Country Sensibility

17 Aug 2007, 3:21 AM
#15
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

tinypack:

I received an order today with a different shipping address from billing and the order appeared correctly in Zen-Cart. The customer must have noticed that the ship to address had to be changed in PayPal too.

The problem is that when a customer fills out the billing/payment info in PayPal, PayPal automatically fills in the shipping address with the billing address instead of receiving the correct ship to address from zen-cart. I think PayPal prefers to have the billing/ship to address the same. I know this reduces potential fraud, but many of my customers send my items as gifts and this difficulty could cause customer service problems. It also creates double entry work for the customer and it could easily be missed if they aren't paying attention.

I wish I could dive into the code to work this out, but unfortunately my coding skills are pretty messy.

There is a bit more to it though as the shipping calculation is also incorrect and is very noticeable when the customer is in another country :blink: The taxes are also calculated incorrectly (when the customer is from another country and shipping the order to the store's home country).

All this aside though it makes it really hard to know where the customer actually wants the order shipped to :smile:

19 Aug 2007, 7:34 AM
#16
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

I have made some progress and thought I would share it so you can add your opinions or advice.

If I change the code at round line 1917 of my includes/modules/payment/paypalwpp.php file from:

$_SESSION['sendto'] = $_SESSION['customer_default_address_id'];

	        // This is the address matching section
	        // try to match it first
	        // note: this is by no means 100%
	        $address_book_id = $this->findMatchingAddressBookEntry($_SESSION['customer_id'], $order->delivery);

	        // no match, so add the record
	        if (!$address_book_id) {
	          $address_book_id = $this->addAddressBookEntry($_SESSION['customer_id'], $order->delivery, false);
	        }

	        // set the address for use
	        $_SESSION['sendto'] = $address_book_id;

to this:

if(!isset($_SESSION['sendto']) || $_SESSION['sendto'] == ''){
	        $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];

	        // This is the address matching section
	        // try to match it first
	        // note: this is by no means 100%
	        $address_book_id = $this->findMatchingAddressBookEntry($_SESSION['customer_id'], $order->delivery);

	        // no match, so add the record
	        if (!$address_book_id) {
	          $address_book_id = $this->addAddressBookEntry($_SESSION['customer_id'], $order->delivery, false);
	        }

	        // set the address for use
	        $_SESSION['sendto'] = $address_book_id;
		}

then the address is added to the order correctly in the scenario we are having trouble with. I just added the first IF statement. The only problem that doing this creates (that I have found so far) is that if the customer changes their address on the PayPal screen it does not get added to the order.

What this means is that as long as the customer chooses the same shipping address during checkout as they do on the PayPal screens (if they change it) then we have a workaround :cool:

If someone could take a look and see what other implications this may have I would appreciate it. Also if there is a way to change my IF statement to allow the code to execute when the address is changed on the PayPal screens then this would work perfectly.

Any ideas?

19 Aug 2007, 12:05 PM
#17
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

I think I finally may have found a viable solution but I need some help getting the data into the PayPal tables properly. This solution is independent of the one I posted earlier and seems much cleaner and less risky.

In my travels around the PayPal developer’s handbooks I found a new API function which I had not seen before. This function is "NOSHIPPING". When I came across it I new it was the answer:lookaroun. Basically this API call removes the customer’s option to change their shipping address on the PayPal screen. The code I wrote only runs if their selected shipping address is not the same as their default one and their account is not a temporary one.

Find this code:

    /**
     * Ask PayPal for the token with which to initiate communications
     */
    $response = $doPayPal->SetExpressCheckout(number_format($order_amount, 2), $return_url, $cancel_url, $options);
``` (line 1668 or so of my includes/modules/payment/paypalwpp.php)

Just ABOVE it add:

if(isset($_SESSION['sendto']) && isset($_SESSION['customer_default_address_id'])
&& $_SESSION['sendto'] != $_SESSION['customer_default_address_id'] && isset($_SESSION['customer_id'])){
//This user has selected a shipping address other than their default address book entry
$sql = "SELECT customers_paypal_ec
FROM " . TABLE_CUSTOMERS . "
WHERE customers_id = '".$_SESSION['customer_id']."' ";
$check_customer = $db->Execute($sql);

if (!$check_customer->EOF) {
	if ($check_customer->fields['customers_paypal_ec'] != '1') {
		//this is not a temporary account so hide the shipping detail on the PayPal screen
		$options['NOSHIPPING'] = 1;
	}
}

}


This seems to work really well as far as I can see except that in our scenario (customer choosing different shipping address) it does not enter all address details correctly into the PayPal table as there is no address response from PayPal. The shipping address is entered into the Zen orders tables correctly and shows the correct shipping address.

DrByte I would appreciate if you could take a look at the code above and let me know if it is a viable workaround/patch as there seems to be many threads dealing with the same issue as we are here. Most of the other threads don't have any real answers and some contain custom hacks that don't look too sound to me.
19 Aug 2007, 6:25 PM
#18
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: PP Express shipping question

The NOSHIPPING option already does get set if the cart-contents are all virtual (ie: downloads, and not requiring shipping).

So, yes, it's possible to blindly disable all shipping address options from the PayPal interface; however there are some caveats to that ...

Consider the case where you have a new customer ... they don't have an account on your site, but they do have a PP account. If they select an address from their PP address book, then that'll automatically be set up in their Zen Cart account, meaning they won't have to create all their address details. If you disable the PP address book, then Zen Cart will not get those details ... and indeed may end up with unpredictable results due to blank data.

For existing customers, it wouldn't be as much of an issue ... but ... due to the nature of "Express", you don't know if the customer has an account or not until after they've logged into PayPal and provided an email address for lookup. And at that point they're already in PayPal, so you can't disable their address book options in PP. :lookaroun

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Aug 2007, 8:21 PM
#19
duwane avatar

duwane

Zen Follower

Join Date:
Aug 2004
Location:
Auckland, New Zealand
Posts:
120
Plugin Contributions:
0

Re: PP Express shipping question

DrByte:

Consider the case where you have a new customer ... they don't have an account on your site, but they do have a PP account. If they select an address from their PP address book, then that'll automatically be set up in their Zen Cart account, meaning they won't have to create all their address details. If you disable the PP address book, then Zen Cart will not get those details ... and indeed may end up with unpredictable results due to blank data.

DrByte:

you don't know if the customer has an account or not until after they've logged into PayPal and provided an email address for lookup. And at that point they're already in PayPal, so you can't disable their address book options in PP.

Thanks DrByte. I thought of that while writing this code and was under the impression that the code I wrote would not fire if the customer did not have an account (no $_SESSION['customer_id']) in their session and they also wouldn't have a $_SESSION['sendto'] or $_SESSION['customer_default_address_id']. Also I am doing a check to see if the account was created by the EC checkout process ($check_customer->fields['customers_paypal_ec'] != '1').

Any further thoughts? I am now trying to figure out where in the code the PayPal return data is written to the PayPal table but it got a bit late last night and mind fuzz set in :smile:

19 Aug 2007, 8:53 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: PP Express shipping question

Mind fuzz ... yes, I know what you mean.

Admittedly, I didn't check your code closely enough to see your check for customer id being set in the session. Will have to review again when my mind is clear.

I am now trying to figure out where in the code the PayPal return data is written to the PayPal tablewhich data are you referring to? There are a few places where data gets written. Best to search for TABLE_PAYPAL if it's the paypal table you're specifically looking for.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.