Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Magento 1.6.0 not storing Paypal buyer email addresses
 
degmau5
Jr. Member
 
Total Posts:  4
Joined:  2009-11-17
 

This is a sporadic issue and is not happening all the time, but since the upgrade to 1.6.0 we are now receiving Paypal orders and the email address is not being stored in the Magento database. We are receiving the email from Paypal as you can see in the screenshot, but in the account information filed, the email is blank. This means that the customers are not receiving an order confirmation email from us, and we cannot market to them at a later date.
This was not a problem in 1.4 our previous version and I wondered if anyone else has had this issue since upgrading, and if so what have you done to fix it.
As I mentioned this is sporadic, but there is no pattern (that I can see). It happens to verified, unverified, confirmed, unconfirmed buyers, Im sure I am missing something

Image Attachments
missingemail.JPG
 
Magento Community Magento Community
Magento Community
Magento Community
 
inevitable
Jr. Member
 
Total Posts:  4
Joined:  2011-12-09
 

Did you get this resolved we are having the same problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kjtolsma
Jr. Member
 
Total Posts:  3
Joined:  2011-06-29
 

I’m having the same problem with Magento 1.6.2. Magento 1.7 seems to have a lot of bug fixes for issues with PayPal. But would it fix this problem? Does anyone have a solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kjtolsma
Jr. Member
 
Total Posts:  3
Joined:  2011-06-29
 

Someone got a solution for this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
spectrumaudio
Member
 
Total Posts:  39
Joined:  2008-07-22
 

BUMP - I am having the same issue.

 
Magento Community Magento Community
Magento Community
Magento Community
 
spectrumaudio
Member
 
Total Posts:  39
Joined:  2008-07-22
 

Anyone out there know how to fix this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
spectrumaudio
Member
 
Total Posts:  39
Joined:  2008-07-22
 

SOLVED: Credit to @DarkNova

Magento acknowledged the bug and says they will fix it. To fix temporarily Modify app/code/core/Mage/Paypal/Model/Express/Checkout.php and go down to: _prepareCustomerQuote() and insert the following line before “$quote->setCustomer($customer);” near the end of the function:

if (isset($customerBilling)) 
$customer
->setEmail($customerBilling->getEmail()); 
}

This will set the email to what was passed in the billing address (which comes from Paypal).

I also noticed that the customer_is_guest flag is not being set properly for these orders, which specifically causes Magento to use the wrong email template when sending order status and shipping notifications. To temporarily fix this I put the following right after my previous fix:

if (!$quote->getCustomerId()) 
$quote
->setCustomerIsGuest(true
->
setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID); 
}

SO TO RECAP - find: _prepareCustomerQuote() and insert the following line before “$quote->setCustomer($customer);” near the end of the function:

if (isset($customerBilling)) 
$customer
->setEmail($customerBilling->getEmail()); 
$customer->setFirstname($customerBilling->getFirstname()); 
$customer->setLastname($customerBilling->getLastname()); 

if (!$quote->getCustomerId()) 
$quote
->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID); 
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Deicist
Jr. Member
 
Total Posts:  2
Joined:  2012-03-19
 

I think I’ve got a slightly better fix for this issue, based on code from 1.7 (the issue is fixed in this version).

http://www.tall-paul.co.uk/2012/06/15/magento-email-address-when-using-paypal-express-in-1-6/

Basically you set the checkout type correctly based on whether the user is logged in or not when they come back from paypal.  This avoids any issues with email templates or whatever.

The code as deployed in 1.7 doesn\\\’t quite work in 1.6… it checks if guest checkout is enabled / disabled to see if you need to do a guest or a ‘register’ checkout.  To make it work as standard magento 1.6 (which I believe allows guest checkouts via paypal express even if you have guest checkout disabled) I had to make some changes.  This now works for my store, your mileage may vary.

If anyone’s interested this is the code as ripped from 1.7:

public function getCheckoutMethod()
    
{
        
if ($this->getCustomerSession()->isLoggedIn()) {
            
return Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER;
        
}
        
if (!$this->_quote->getCheckoutMethod()) {
            
if (Mage::helper(\\\'checkout\\\')->isAllowedGuestCheckout($this->_quote)) {
                $this
->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
            
else {
                $this
->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER);
            
}
        }
        
return $this->_quote->getCheckoutMethod();
    
}

I\\\’ve changed it to this:

public function getCheckoutMethod()
    
{
        
if ($this->getCustomerSession()->isLoggedIn()) {            
            
return Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER;
        
else {
            $this
->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);            
            return 
$this->_quote->getCheckoutMethod();
        
}        
    }

edit: ignore the multiple backslahes, this forum escapes characters when you hit ‘submit’ but then if you get the captcha wrong it doesn’t unescape them before returning you to your post to try again… doh.

 
Magento Community Magento Community
Magento Community
Magento Community
 
netengine73
Jr. Member
 
Total Posts:  10
Joined:  2012-06-19
 

I was having the same problem in 1.6.2. This should include this thread as well:

http://www.magentocommerce.com/boards/viewthread/286762/

I noticed the email issue first when reviewing all my orders. Email address was missing for the Paypal orders. I then noticed that the billing address was not populated. The customer required that address since they only ship Paypal orders to the billing address.

As you should know by now, Paypal allows the buyer to pick any address in their profile as the shipping address. Also, by default the billing address is not available to the seller. Paypal must flag the seller account as allowed to request the billing address. This is step 1! If the account is not flagged to allow the billing address, call Paypal.

Here is the file/fix(/app/code/core/Mage/Paypal/Model/Api/Nvp.php near line 584):

public function callSetExpressCheckout()
    
{
        $this
->_prepareExpressCheckoutCallRequest($this->_setExpressCheckoutRequest);
        
$request $this->_exportToRequest($this->_setExpressCheckoutRequest);
        
$request['REQBILLINGADDRESS'1;
        
$this->_exportLineItems($request);

Insert the line “$request[’REQBILLINGADDRESS’] = 1;” before the request is sent.

That is it! I changed the core code in my install because this is not a problem in CE 1.7. Check the 1.7 code and you will find the REQBILLINGADDRESS value is being sent with the request.

 
Magento Community Magento Community
Magento Community
Magento Community
 
trucatch
Jr. Member
 
Total Posts:  13
Joined:  2012-04-03
 

Hi,

I attempted to fix this bug in file app/code/core/Mage/Paypal/Model/Express/Checkout.php but I have not noticed any changes with the backend of the Magento website. This is what I have done according to the steps:

protected function _prepareCustomerQuote()
{
$quote = $this->_quote;
$billing = $quote->getBillingAddress();
$shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();

$customer = $this->getCustomerSession()->getCustomer();
if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
$customerBilling = $billing->exportCustomerAddress();
$customer->addAddress($customerBilling);
$billing->setCustomerAddress($customerBilling);
}
if ($shipping && ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling())
|| (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook()))) {
$customerShipping = $shipping->exportCustomerAddress();
$customer->addAddress($customerShipping);
$shipping->setCustomerAddress($customerShipping);
}

if (isset($customerBilling) && !$customer->getDefaultBilling()) {
$customerBilling->setIsDefaultBilling(true);
}
if ($shipping && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) {
$customerBilling->setIsDefaultShipping(true);
} elseif ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) {
$customerShipping->setIsDefaultShipping(true);
}
if (isset($customerBilling)) {
$customer->setEmail($customerBilling->getEmail());
$customer->setFirstname($customerBilling->getFirstname());
$customer->setLastname($customerBilling->getLastname());
}
if (!$quote->getCustomerId()) {
$quote->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
}

$quote->setCustomer($customer);

return $this;
}

What I have underlined is of course what I have added to the code. And there is some code below as well. But for some reason, probably user error, I am still not receiving any of the Account Information like Customer Name and Email. Also the Billing Address has only a name and country. I can see the email in Payment Information under Payer Email.

Also under Order # the order status is Processing and it is saying the order confirmation email was sent but I am guessing that is because its just sending it to a random Guest email created. If there is anything I can do PLEASE HELP! It is really starting to be a pain to answer around 25 calls a day just to tell them that we have received their order. If you need more information I am willing to give.

Also I read this was fixed in 1.7 but I am kind of scared to upgrade since I have heard a few people have lost their website and I definitely do not want to do that.

Thank you,

Ryan

 
Magento Community Magento Community
Magento Community
Magento Community
 
netengine73
Jr. Member
 
Total Posts:  10
Joined:  2012-06-19
 

It is good that you replied since I have been meaning to update this post. I did also need to change my paypal/model/express/Checkout.php file to finally get it working. Look for the function returnFromPaypal($token) and make sure you comment out the lines shown here:

public function returnFromPaypal($token)
    
{
        $this
->_getApi();
        
$this->_api->setToken($token)
            ->
callGetExpressCheckoutDetails();
        
$quote $this->_quote;

        
// import billing address
        
$billingAddress $quote->getBillingAddress();
        
$exportedBillingAddress $this->_api->getExportedBillingAddress();
        
$quote->setCustomerEmail($billingAddress->getEmail());
        
$quote->setCustomerPrefix($billingAddress->getPrefix());
        
$quote->setCustomerFirstname($billingAddress->getFirstname());
        
$quote->setCustomerMiddlename($billingAddress->getMiddlename());
        
$quote->setCustomerLastname($billingAddress->getLastname());
        
$quote->setCustomerSuffix($billingAddress->getSuffix());
        
$quote->setCustomerNote($exportedBillingAddress->getData('note'));
        foreach (
$exportedBillingAddress->getExportedKeys() as $key{
            
//if (!$billingAddress->getDataUsingMethod($key)) {
                
$billingAddress->setDataUsingMethod($key$exportedBillingAddress->getData($key));
            
//}
        
}

If you do this and change the Paypal/Model/Api/Nvp.php file as I suggested in my previous post, then you should start seeing the billing address. Back out any other changes you have made. I found they are not necessary.

What ultimately helped me discover a solution was enabling the debug mode for Paypal in the admin. Once you enable that, cat the var/log/payment_paypal_express.log. You should see the response coming back from Paypal with the proper billing address.

I tar’d the two files and attached so you can check it out.

File Attachments
paypal-billing-fix-1.6.2.tar  (File Size: 90KB - Downloads: 92)
 
Magento Community Magento Community
Magento Community
Magento Community
 
trucatch
Jr. Member
 
Total Posts:  13
Joined:  2012-04-03
 

Thank you for your reply.

But I am still having problems. I tried all 3 fixes and did not receive any results. Do I have to do something to refresh the system?

Here are the changes I have made to Nvp.php:

public function callSetExpressCheckout()
{
$this->_prepareExpressCheckoutCallRequest($this->_setExpressCheckoutRequest);
$request = $this->_exportToRequest($this->_setExpressCheckoutRequest);
$request[\’REGBILLINGADDRESS\’] = 1;
$this->_exportLineItems($request);

Here are the changes to Checkout.php(I also removed all the other changes):

public function returnFromPaypal($token)
{
$this->_getApi();
$this->_api->setToken($token)
->callGetExpressCheckoutDetails();
$quote = $this->_quote;

// import billing address
$billingAddress = $quote->getBillingAddress();
$exportedBillingAddress = $this->_api->getExportedBillingAddress();
$quote->setCustomerEmail($billingAddress->getEmail());
$quote->setCustomerPrefix($billingAddress->getPrefix());
$quote->setCustomerFirstname($billingAddress->getFirstname());
$quote->setCustomerMiddlename($billingAddress->getMiddlename());
$quote->setCustomerLastname($billingAddress->getLastname());
$quote->setCustomerSuffix($billingAddress->getSuffix());
$quote->setCustomerNote($exportedBillingAddress->getData(\’note\’));
foreach ($exportedBillingAddress->getExportedKeys() as $key) {
//if (!$billingAddress->getDataUsingMethod($key)) {
$billingAddress->setDataUsingMethod($key, $exportedBillingAddress->getData($key));
//}
}

I also went into the admin panel and changed Paypal Express to Debug Mode. If you have any other ideas for me, they would be greatly appreciated. Thank you very much again for the reply.

Ryan

 
Magento Community Magento Community
Magento Community
Magento Community
 
netengine73
Jr. Member
 
Total Posts:  10
Joined:  2012-06-19
 

in this line:

$request[\’REGBILLINGADDRESS\’] = 1;

Remove the two \ characters if they are in your code. Those are escaping characters and not necessary.

Did you look in the payment log file and see if you are getting the billing address back?

Also, I had a spelling error in my Nvp.php file that I thought might have been my own. Check this line and make sure it says STREET and not SREET:

‘SREET’ => ‘street’,

let me know.

Jason

 
Magento Community Magento Community
Magento Community
Magento Community
 
trucatch
Jr. Member
 
Total Posts:  13
Joined:  2012-04-03
 

Jason,

Well I noticed two problems when I went back in ($request[\’REQBILLINGADDRESS\’] = 1;) I actually had a \’G\’ instead of a \’Q\’. So I fixed that error and then I found the \’SREET\’ problem as well and placed \’STREET\’ instead.

Also the two \’\\\’ are appearing after I post but are definitely not in my code.

But the bad news is the program is still not working correctly. Plus I do not know how to check the payment log file?

Thanks,
Ryan

 
Magento Community Magento Community
Magento Community
Magento Community
 
trucatch
Jr. Member
 
Total Posts:  13
Joined:  2012-04-03
 

Will this change only work for new orders or will it change all of our previous orders as well?

 
Magento Community Magento Community
Magento Community
Magento Community
 
netengine73
Jr. Member
 
Total Posts:  10
Joined:  2012-06-19
 

Only new orders.

Were you able to get it working?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2