Since upgrading Ubercart to 6.x-2.4, I've received two orders. Both were paid with Paypal Website Payments Standard. For both orders, the customer paid with Paypal, and I received the e-mail from PayPal confirming the payment. Both customers did not click back through from PayPal to the Ubercart site. The only e-mail I got was from PayPal; no e-mail came from the site advising me of the order; the stock levels were not decremented in Ubercart; the order status remained at "In Checkout" and did not change to "Pending".

I looked at the Recent Logs for the site, and there were two entries for each order. "IPN for a different PayPal account attempted" followed on from "Receiving IPN at URL for order nnnn".

It sounds like 6.x-2.4 is requiring that the PayPal e-mail address of the customer is the same as the Ubercart store e-mail address for the customer, but I may be wrong. Whatever is causing this, the workflow of placing an order with PayPal is not working as it should, as those customers would not be able to see their recent orders in the list of all the orders they have placed, and they would not get confirmation of the order by e-mail. Also, Ubercart has not matched the payment to the order, so it looks to the customer and to me as if they have not paid.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JamesOakley’s picture

Edit: Strike my theory. Both those orders had the same e-mail address on my website and on the PayPal notification e-mail that I got. Something else is going on

Could it relate to the fact that my one PayPal account has more than one e-mail address associated with it?

JamesOakley’s picture

I can now add a little more information. I didn't realise that PayPal kept an "IPN History" for my account, containing details of every IPN that is sent. I've tracked down the two from today. One field is &business=[store e-mail]. Another is &receiver_email=[PayPal account primary e-mail address]. They're both as they should be (which is two different addresses, because the PayPal address used by the store is not the primary address on my account).

Everything is as it should be, so none of this should break the IPN / Ubercart Order link.

Island Usurper’s picture

Are you using Website Payments Standard or Pro? The WPS settings should contain a setting for the email address that is associated with your store, but the WPP settings used the tokens and password. I duplicated the email setting to the Express Checkout settings, so changing it in one changes the other, but the warning shouldn't show up if the email isn't set.

JamesOakley’s picture

I'm using standard. The e-mail address I've entered in the store settings is the one I want the payments to go to from the customer's point of view, chosen so that the domain matches the store's. The primary address on that Paypal account is different, being one on my personal domain. I'm not just getting a warning in the log; the payment is being attached to the order. Does that help?

spazfox’s picture

I'm having the exact same problem after upgrading Ubercart to 6.x-2.4 (also using PayPal Website Payments Standard). Any solution yet, James?

spazfox’s picture

rlange77’s picture

After I changed the return page in my PayPal account the orders are getting confirmed but we dont get the paypal payment confirmation back to the shop.
So the payment is done and we got the confirmation email from paypal but not back into ubercart.
Means the order status is now "waitung for payment".

we also can confirm that our primary paypal email address is different to the the one we us for the shop but we get the confirmation email from paypal to the shop address and NOT to the primary email address.

anyone can confirm it?

JamesOakley’s picture

Title: IPN for a different PayPal account attempted. » Paypal WPS only works with the primary e-mail address for a Paypal account

I can now confirm that this is the problem. As an experiment and temporary work-around, I've changed the primary e-mail address for my Paypal a/c so that it is the one I use for Paypal in the store. Changing no other settings in the store, payments now match up OK. So that is the issue.

This does as a temporary work around, but long term it is not desirable, because it would mean each store would have to use its own Paypal a/c if the domain names for the store and Paypal e-mail are to match.

Anyone else with this problem confirm that this work-around helps?

spazfox’s picture

I can confirm that this work-around seems to have corrected the problem for me, too.

rlange77’s picture

I can confirm it as well and also that we get duplicated invoice emails and stock decrease again since I changed the primary email address at PayPal.
So I go back to my real primary address and change the payment details each order by hand til someone comes up with a solution as
duplicated stock decrease isnt really what we need either.

JamesOakley’s picture

Well it looks like we've identified the issue.

I suspect the double e-mails is a red herring: (double) e-mails are triggered by incoming IPNs. Now you've fixed the IPNs, the (double) e-mails are back.

Let's leave that issue to its own queue and use this queue to solve the problem that primary Paypal e-mails are needed.

rlange77’s picture

agreed. is there an open issue for the duplicated emails for version 2.4 already or should i open a new one?

JamesOakley’s picture

greggles’s picture

Subscribing.

flyfisher_xy’s picture

Changing the primary email address for PayPal to match the payment address in Ubercart corrected the issue for me as well. Website orders are now again saying "Payment Received" and the actual PayPal transaction id shows up instead of being listed as "Unknown". Thank you.

RikiB’s picture

I just had several orders overnight get stuck in the "pending" state. In the DB Log it says "IPN for a different PayPal account attempted".

Sure enough I have a different primary email in paypal so I changed it to match and I hope it fixes the issue. If it doesn't I will report back. Thanks for the solutions!

JamesOakley’s picture

Status: Active » Needs work
FileSize
647 bytes

See my comments in #2 above.

Could it be as simple as the attached patch?

I suggest it tentatively, because I'm aware that ensuring the PayPal IPN was for the correct account was one of the SA issues surrounding the recent release. Could someone review whether this change is safe, or whether it reintroduces the security issue?

RikiB’s picture

#8 fixes it for me, confirmed

greggles’s picture

@RikiB, how about the patch in #17. That looks reasonable to me though I'm not super familiar with the Paypal API.

RikiB’s picture

I wish I could tell you but I know nothing about the code. I could try and change my primary like I had it before and apply the patch to see if the next customer has a problem if you want.

arh1’s picture

we, too, saw this problem after updating to Ubercart 6.x-2.4. new orders were not showing the 'completed' status at our site even after payment was completed at PayPal, and the dblog shows a "IPN for a different PayPal account attempted." log entry after each log entry like "Receiving IPN at URL for order nnn."

changing the "primary email address" listed in the PayPal account to match the address listed under "PayPal e-mail address:" in the "PayPal Website Payments Standard settings" fieldset at /admin/store/settings/payment/edit/methods seems to have fixed the problem.

i'm still unclear as to the circumstances that might have left orders with an 'in checkout' status as opposed to a 'pending' status -- it appears that we have orders with both statuses where payment was actually completed at PayPal. does anyone have any insight into that yet?

greggles’s picture

@arh1 - that last symptom sounds like a different problem/feature of paypal where payment made with one of the less reliably payment forms has to wait to get cleared before moving to completed. I can't find the issue for it now.

arh1’s picture

@greggles -- thanks. yeah, we definitely have orders that regularly get stuck with an 'in checkout' status, presumably for other reasons (e.g. the customer has second thoughts and bails before completing payment at PayPal, etc). but, in the few days between the time we updated UC to 6.x-2.4 and the time we changed the PayPal primary email address per this issue we have a way higher number of orders stuck with the 'in checkout' status.

since the original poster above mentioned orders staying at 'in checkout', i'm wondering if this issue (or a similar issue related to the 6.x-2.4 update) might leave orders with that status as well as 'pending', and if we can tease out why it might be one or the other.

Island Usurper’s picture

Status: Needs work » Needs review

Checking the "business" email should work, since that's what the email setting is sent as to WPS. What I need to find out is if that will still work with Express Checkout/WPP. I think the PayPal email is associated with the authentication tokens they give you, but that wasn't stored by Ubercart until we started checking it.

Could someone using Express Checkout and/or Websites Payment Pro verify that a "business" key appears in the IPNs that come back?

jakew’s picture

Subscribe

arithmetric’s picture

PayPal's IPN documentation says that the 'business' and 'receiver_email' values will be the same if you request payment to the primary account. Otherwise, 'receiver_email' shows the primary account and 'business' shows the account e-mail address used in the payment request. See:
https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=devel...

mrbubbs’s picture

I encountered this issue as well. I figured out someone who also has access to the PayPal account accidentally changed the primary email address. I have changed it back.

Unfortunately, I have orders that were affected by this issue. Now that I have changed the PayPal primary address, is there a way to have Ubercart retry the PayPal portion of the process without having to contact the customers?

I think that the customers may have received an invoice email as if the transaction was successful, but I see that PayPal does not have the amount for the orders logged in the transaction history.

Thanks!

arh1’s picture

@mrbubbs: as i understand it, this issue shouldn't have any effect on what's happening at PayPal -- orders should be processed normally. the problem is just that after processing the order PayPal's IPN data is not being received back by Ubercart, so that the order status in Ubercart is never properly changed to 'completed'. i'm not sure if there might be any other ramifications within Ubercart -- a quick scan of the UI (e.g. the default conditional actions) suggests not, but that's as far as i've looked (i haven't poked at the code at all).

i have advised my clients to manually update the order status for affected orders to 'completed', and also add an admin comment for such orders to make note of the manual change.

mrbubbs’s picture

Thanks, arh1. You are correct. I have figured out that the transactions did go through. It was just the Pending status that had me wondering. I changed the primary email back to match the email that Ubercart uses and I no longer have "different IPN" errors in the log. Also, the orders are now being marked as Completed.

TR’s picture

Sounds like the patch works for WPS, but as per #24 still waiting to hear that it doesn't break WPP or Express. If someone can test that then this can get committed.

Anonymous’s picture

Some more info that may be useful on this:

I'm using WPP with Express Checkout and since upgrading from UC 2.2 to 2.4 have been having the same issue with Express Checkout orders getting stuck as a status of "Pending" even though the transaction is completed successfully on the PayPal side. All email addresses throughout UC match with the PayPal business address so that wasn't the problem.

It's been a couple of weeks since doing the upgrade and I haven't had much time to look into it. So today I took another look at the code and forgot that I had already applied the #17 patch. With the patch applied and looking back at the error log, the "IPN for a different PayPal account attempted." was causing the issue on PayPal orders.

So I undid the #17 patch and was surprised to see that status is being set to "Payment Received" as expected (which makes me totally confused why I applied the patch in the first place, when I don't believe anything else has changed!). I've now enabled the full IPN logging in UC and can see that "business" doesn't exists as a variable in the IPN. This explains why patch #17 fails for me.

Island Usurper’s picture

Status: Needs review » Fixed

We're using PayPal WPS on our site, and it seems to work fine.

Thanks and committed.

JamesOakley’s picture

Status: Fixed » Needs work

Forgive me if I'm wrong; if I've read martinjbaker correctly, he's saying that the patch may work for PayPal WPS, but that the PayPal WPP does not include a 'business' field in the IPN, so it doesn't work for WPP. If that is indeed correct, the patch would need modifying for WPP, but I don't know how. If the PayPal primary address is not the one being used by Ubercart, we need to read the Ubercart recognisable e-mail address out of the IPN somehow. That needs someone: (i) who is using PayPal WPP, and (ii) uses an e-mail address other than their primary one to tell us the field to use.

Probably the correct course of action is to leave the patch at #17 committed; at least that fixes the issue for WPS. Someone using WPP can try and resolve the issue for them. Perhaps it would clarify things if that were opened as a new issue.

Marking as 'needs work' so that Island Usurper can decide the best way for this to be picked up.

pcorbett’s picture

Having a similar issue with PayFlow Pro and Ubercart 2.4. In only one case that I can see (so far), an order was created and the user was charged via PayPal, but the order remained in "In Checkout" status. I don't believe, for PFP, there is an email setting for the payment processor, but I will make sure the API users's email is the same as the primary contact's. Since this isn't happening on a consistent basis, I wonder if my issue is related or not?

miaoulafrite’s picture

subscribing

Island Usurper’s picture

Yeah, sorry. I got confused about which one we were unsure about and jumped the gun. It doesn't help that the IPN documentation isn't even clear that WPP sends IPNs for regular payments. Usually it just talks about recurring payment IPNs.

I guess a partial fix is better than none at this point. We should really try to figure out WPP soon, though.

danrasband’s picture

Another problem with the IPN receiver email checking occurs when the emails have different cases (uppercase and lowercase). This patch addresses that issue by lowercasing both the email from Ubercart config and from PayPal. It also adds a couple of variables to the log for better debugging of any errors occurring here.

danrasband’s picture

Here's the same patch as above but without the watchdog changes. I guess they are not really needed if debug is enabled for the uc_paypal module.

TR’s picture

@danrasband: #38 and #39 are not in the proper format for a patch. Please fix. See http://drupal.org/patch/create

that0n3guy’s picture

Hey, I created a patch using #17 but just made it act like normal if 'business' isn't included in the IPN (#31 states that "business" isn't there for express checkout).

I also added the "case" stuff from danrasband.

that0n3guy’s picture

oops, had an extra variable in there... here is a fixed patch.

dpatte’s picture

sub

adrianmak’s picture

subscribe

PieterDC’s picture

sub

Aron Novak’s picture

subscribe

YK85’s picture

subscribing

asb’s picture

sub

TR’s picture

Priority: Critical » Major

@dpatte
@adrianmak
@PieterDC
@Aron Novak
@YK85
@asb

If you would like to see the issue resolved, rather than just "subscribing" you should try the patch in #41 and post a comment saying how you tested, what you tested, and if it worked for you or didn't work for you.

asb’s picture

The patch from #41 can not be applied from within the Ubercart module directory, neither with or without the -p0 option ("can't find file to patch at input line 14"). It applies cleanly when applied from within ./sites/all/modules/ubercart/payment/uc_paypal and without the -p0 option. I'll report back if it changes something for better or worse.

longwave’s picture

You should be able to apply it cleanly with patch -p1 from the Ubercart module directory (this is because it is a git format patch, and these need -p1 to apply, rather than -p0 from the CVS days).

hanoii’s picture

Status: Needs work » Needs review

Although already linked on #13 to #644538: Duplicate order notification e-mail, and duplicate stock decrement, I want to say that I came across this while testing Express checkout with dev, as there is some commit of this issue, and in an attempt to fix that long commented and awaited issue I will also try and include this patch in the fix there, so hopefully we can wrap up a bunch of paypal issues together.

Status: Needs review » Needs work

The last submitted patch, 0001-fix-for-paypal-only-works-with-primary-email-and-m.patch, failed testing.

hanoii’s picture

btw, just tried it and worked just fine, but if you can hold the commit of this one I will include it the the other issue. I know it's not great t have a patch address a lot of issues, but these are all quite related.

hanoii’s picture

As mentioned in #53, a patch with this included is in #644538-291: Duplicate order notification e-mail, and duplicate stock decrement, tests on that patch will be really appreciated.

dww’s picture

Version: 6.x-2.4 » 6.x-2.x-dev
Assigned: Unassigned » dww
Status: Needs work » Needs review
FileSize
1.88 KB

Patch #41 doesn't apply cleanly to the 6.x-2.x branch, since it was rolled relative to 6.x-2.4 itself. Due to comment #32, there was a partial fix committed. So, I rerolled the patch relative to the end of the 6.x-2.x branch.

While I was at it, I cleaned up the logic a bit (we were calling variable_get() multiple times for no reason) and also split out the error condition where the uc_paypal_wps_email variable isn't defined vs. it doesn't match the email specified in the IPN. I added a TODO since it seems like testing that uc_paypal_wps_email is undefined should really be a requirements check that we alert site admins about early, not something we do once we're actually processing an IPN. But, that seemed like a bigger change than I wanted to get into here.

I've tested this on a site. Before the patch, PayPal orders are left in "Pending", I get the watchdog about the IPN not matching, etc. With the patch, the order goes through fine and moves to "Completed" (the product I was testing with isn't shippable). I'm only testing via WPS, not WPP or express checkout.

I think this is RTBC based on the other comments here, but since it's my own patch, I'll leave it "needs review".

Also, huge -1 to rolling this fix into the monster patch at #644538: Duplicate order notification e-mail, and duplicate stock decrement. It just makes it much harder to understand what's going on. Let's fix discrete bugs in discrete issues with discrete patches. Otherwise, we create a big mess that's harder to review and understand.

Thanks!
-Derek

longwave’s picture

Doesn't the comment above that block explain why uc_paypal_wps_email may not be set? "Express Checkout IPNs may not have the WPS email stored." - seems like this needs testing on Express Checkout where WPS is not configured.

dww’s picture

Tee hee, so it does. ;) So that means sites using Express Checkout simply do not define the 'uc_paypal_wps_email' variable at all? In that case, this patch should be what you need. As I said, I'm only testing with WPS, since that's all I've got access to for now.

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

Committed. Needs porting to 7.x.

dww’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
% git checkout 7.x-3.x
Switched to branch '7.x-3.x'
% git am 881606-57.uc_paypal-IPN-fixes.patch
Applying: Issue #881606 by danrasband, that0n3guy, dww: More fixes for IPN processing.
% git log

commit d7b1c92a62df65be8056463cda6d8ccddde1b163
Author: Derek Wright <git@dwwright.net>
Date:   Wed May 11 16:08:53 2011 -0500

    Issue #881606 by danrasband, that0n3guy, dww: More fixes for IPN processing.
...

I definitely don't have a D7 UberCart site to test with, but at least as far as the code is concerned, commit #57 applies cleanly to the end of the 7.x-3.x branch, too. ;)

Thanks for fixing this!

Cheers,
-Derek

longwave’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.