Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Issue:
When using Paypal WPS, no account is created for the anonymous user after the payment is completed. The user information recieved from the IPN are never stored in the order.
To fix this, I've added the following code in uc_paypal_ipn.
if(empty($order->primary_email))
{
$order->primary_email = $payer_email;
uc_order_save($order);
}
Having an e-mail address enables uc_cart_complete_sale_account to create an account for the user.
Now I'm wondering if there are any side effects to this hack. And even more if nobody else noticed this issue.
Comments
Comment #1
longwaveHave you disabled the customer information pane on the checkout page? That is usually responsible for collecting primary_email during checkout, though when using PayPal WPS I can see why you wouldn't need your customer to enter the email address twice.
Comment #2
Daniel E CreditAttribution: Daniel E commentedhey longwave, thanks for getting back to me about this. Yes, I have disabled the customer information pane. This works fine with Paypal Express Checkout but it seems like the WPS implementation doesn't consider this case.
So my final live code looks like this (placed before the payment_status switch):
This has been tested with a couple of real transactions and worked without flaws so far. I'll see if it works reliably in the next weeks.
Comment #3
longwaveDoes this work reliably for you? I am wondering about the case where the user clicks back to the site before the PayPal IPN is received, this might cause problems if we do not have an email address by this time..
Comment #4
Daniel E CreditAttribution: Daniel E commentedAfter testing this for a couple of months, I can say that it works 98% of the time (which is actually more reliable than Paypal Express has been lately :D). But sometimes it doesn't work and no account is created and I have to answer rude support e-mails :P
Comment #5
longwaveYeah, I imagine that 2% where it fails is the case I describe in #3 - many users do not click back after PayPal, and even less will manage to do so before the IPN arrives.
Comment #6
Daniel E CreditAttribution: Daniel E commentedDo you think it would be possible to poll the IPN status with ajax and have the user wait until the IPN arrives? I think I've seen something like this on bandcamp. If you think it's possible, I'd give it a shot... Thanks
Comment #7
DanZ CreditAttribution: DanZ commentedNot all the time. Paypal IPNs are not guaranteed to be delivered right away. See https://www.x.com/content/resolved-issue-receiving-instant-payment-notif.... Some IPNs were delayed for more than a day. In theory, they could get lost completely.
If you don't ask for an e-mail address, and the IPN isn't back yet, Ubercart won't know the e-mail address, right?
The TransactionSearch API could be used to look up a transaction, and that contains the e-mail address and other customer information. That could be used as a fallback if the IPN doesn't come through. There might be some caveats for using it, though.
Comment #8
longwaveWe may also be able implement PDT in #1421298: Is there any Paypal PDT support? to deal with the case where users click back from PayPal before the IPN arrives. The Ajax method may work some of the time where the users are particularly fast at clicking back and PayPal is working properly, but as noted above, IPNs can be delayed for 24 hours in some cases, and they are unlikely to want to wait that long!
Comment #9
TR CreditAttribution: TR commented