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 12
Google Checkout - Carrier Calculated shipping problem [semi-solved]
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

I have configured Google Checkout for use with my site and when customers click on Google Checkout, it takes them to the Google Checkout page and everything seems to be working fine, except Google Checkout displays the shipping cost at $0.00 every time. I have Carrier Calculated shipping enabled for Fed-Ex Ground in the Google API section… I went ahead and set a default shipping price to $9.95 so that if Google Checkout encounters an error it will automatically fall back to the default price… Problem is, sometimes that price is too high and sometimes it is too low. I have weights assigned to all of my products and I’m not exceeding the 150 lb limit.

How can I get the Carrier Calculated setting to work correctly?

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

Anyone know why Google isn’t able to allow the carrier to calculate the shipping cost?? Is anyone else having this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
AnnaM
Guru
 
Avatar
Total Posts:  325
Joined:  2008-01-29
San Francisco
 

Yes I am, for me it puts nothing for shipping cost, using carrier calcualted also. Just puts a dropdownlist with 0.00 the only chocie I have UPS Ground only selected.  SOmehow the shipping is not getting passed to goolge properly it seems.

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

Glad to hear that I’m not the only one that is having this problem… Is there anyone who has this working?

I did a search on google and found someone who is using zencart that is having this problem.. and someone posted a solution.. here is the link - http://www.zen-cart.com/forum/showthread.php?t=87303

Does anyone know where I can find the code for google checkout in Magento.. not the part in the admin menu under Google API… maybe Magento has an error in the code??

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

I haven’t been able to figure this out… Does anyone have this working? Has the Magento team recognized this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

I finally got this to work!!! I don’t know how serious a security threat this presents, but here is what I did.

Open:
/public_html/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php

Delete lines 47 - 51:

$status $this->getGResponse()->HttpAuthentication();

        if (!
$status || empty($data[$root])) {
            
exit;
        
}

Open:
/public_html/lib/googlecheckout/googleresponse.php

Delete lines 73 - 119:

/**
     * Verifies that the authentication sent by Google Checkout matches the
     * merchant id and key
     *
     * @param string $headers the headers from the request
     */
    function HttpAuthentication($headers=null$die=true{
      
if(!is_null($headers)) {
        $_SERVER 
$headers;
      
}
      
// moshe's fix for CGI
      
if (empty($_SERVER['HTTP_AUTHORIZATION'])) {
          
foreach ($_SERVER as $k=>$v{
              
if (substr($k, -18)==='HTTP_AUTHORIZATION' && !empty($v)) {
                  $_SERVER[
'HTTP_AUTHORIZATION'$v;
                  break;
              
}
          }
      }

      
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
        $compare_mer_id 
$_SERVER['PHP_AUTH_USER'];
        
$compare_mer_key $_SERVER['PHP_AUTH_PW'];
      
}

  
//  IIS Note::  For HTTP Authentication to work with IIS,
  // the PHP directive cgi.rfc2616_headers must be set to 0 (the default value).
      
else if(isset($_SERVER['HTTP_AUTHORIZATION'])){
        
list($compare_mer_id$compare_mer_key) = explode(':',
            
base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'],
            
strpos($_SERVER['HTTP_AUTHORIZATION']" ") + 1)));
      
else if(isset($_SERVER['Authorization'])) {
        
list($compare_mer_id$compare_mer_key) = explode(':',
            
base64_decode(substr($_SERVER['Authorization'],
            
strpos($_SERVER['Authorization']" ") + 1)));
      
else {
        $this
->SendFailAuthenticationStatus(
              
"Failed to Get Basic Authentication Headers",$die);
        return 
false;
      
}
      
if($compare_mer_id != $this->merchant_id
         
|| $compare_mer_key != $this->merchant_key{
        $this
->SendFailAuthenticationStatus("Invalid Merchant Id/Key Pair",$die);
        return 
false;
      
}
      
return true;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

This does not work for me at all…
Is running GC in Sandbox mode a problem maybe? Or using the UK version of GC - which should be supported?

Please help!
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

One more thing to add… After doing what I mentioned above, it also helps to use Jbeall’s fix:

Open: lib/googlecheckout/googlemerchantcalculations.php
Change lines 80 - 82

Replace:

if($result->tax_amount != â€œ")
$xml_data->Element(’total-tax’, $result->tax_amount,
array(’currency’ => 
$this->currency));

With:

//if($result->tax_amount != "")
$xml_data->Element('total-tax', (float)$result->tax_amount,
array(
'currency' => $this->currency));

This will fix an issue with default prices for people that are not logged in.

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

lisali,

Go to Google checkouts website and login.. Go to: Tools --> Integration Console

Are you getting this error:

We encountered an error trying to access your server at https://secure.yourdomain.com/googlecheckout/api/—the error we got is: Sending failed with HTTP response code: 401. Response body was: Failed to Get Basic Authentication Headers

I had to remove the authentication because I wasn’t able to get it to work with the PHP/CGI limitations.

I’m not using the sandbox so maybe you should try it without. UK shouldn’t be a factor.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hi Etho201,

No - I keep getting “Your server returned no data in its reply; Checkout requires data of type merchant-calculation-results in reply to merchant-calculation-callback”.

I kind of want to test this with GC in Sandbox first before I purchase SSL for my domain.

What seems to be the problem though - could a team member help us out?  Is this a Magento bug, or GC bug, or a specific server configuration problem?

Many thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

lisali,

Did a quick search on google and I found this:

# What do I do when I observe this error: Your server returned no data in its response; Checkout requires data of type merchant-calculation-results in response to merchant-calculation-callback

Check your php version. If it is version 5.2.2, you may have to add the following to /googlecheckout/responsehandler.php.:

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");

Look at your: /public_html/lib/googlecheckout/googleresponse.php

It’s probably not a Magento nor GC bug, it probably has something to do with the settings on your server.

Check out this site: http://demo.globant.com/~brovagnati/tools/
Looks like it has a lot of useful tools for configuring Google Checkout.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hello etho201,

Many thanks for your reply, much appreciated. I tried what you suggested, but that did not work…

I am actually using the suggested .htaccess mod to make Magento work on 1&1;, who I’m hosted with.

Without the fix:
PHP Version 4.4.8

With the fix:
PHP Version 5.2.5

I have emailed Google Checkout to see if they can be of any assistance, so will update this if I hear back from them.

Thanks once again!

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hi Etho,

Have you managed to get this to work? I just tried GC on your website, and it does not seem to work correctly - the shipping charges do not carry over.

Lisa

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

I believe I have it working. Only problem is that it won’t carry over the shipping charge (I’m pretty sure that is a rule required by google, since it is supposed to be a separate “entity"). Google checkout has the carrier calculate the shipping separately, I am not sure as to why it is different from the shipping calculated on my site, but at least it is no longer displaying the default shipping price.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hi Etho,

Many thanks for your reply. Yes - I can see that the shipping quote in your Magento cart is not showing in your GC cart - it shows something completely different. Have you set those charges up in GC?

Could you tell me if the only changes you have made are these (from your earlier posts above):

1. Open:
/public_html/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php
Delete lines 47 - 51

2. Open:
/public_html/lib/googlecheckout/googleresponse.php
Delete lines 73 - 119:

3. Jbeall’s fix: Open: lib/googlecheckout/googlemerchantcalculations.php
Change lines 80 - 82

Did you also add
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");

What is the callback URL you have entered in GC?

Lisa

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

I did everything mentioned but I did not add:
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");

In Google Checkout, my callback url is:
https://secure.mysiteurl.com/googlecheckout/api

Hmm… Come to think of it… Since you don’t have SSL installed on your site… that could be the problem. As far as I know, API callback URL must be a secure address (I haven’t tried sandbox mode). You can get a 3 month free trial from all the main players in SSL (Comodo, Verisign, GoDaddy, etc...) to test this out.

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