Magento Forum

   
Google Checkout - Carrier Calculated shipping problem [semi-solved]
 
barrmy
Sr. Member
 
Avatar
Total Posts:  102
Joined:  2008-06-03
 

did a brand new 1.1.2 install, and applied the URL file...I’m still getting: “We encountered an error trying to access your server at https://www.website.com/googlecheckout/api/—the error we got is: Sending failed with HTTP response code: 401. Response body was: Failed to Get Basic Authentication Headers “
Warnings:

<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-callback xmlns="http://checkout.google.com/schema/2" serial-number="<<serial>>">
  <
shopping-cart>
    <
items>
      <
item>
        <
item-weight value="2.0" unit="LB" />
        <
tax-table-selector>none</tax-table-selector>
        <
item-name>Product 1</item-name>
        <
item-description></item-description>
        <
quantity>1</quantity>
        <
unit-price currency="USD">0.0</unit-price>
        <
merchant-item-id>213441</merchant-item-id>
        <
merchant-private-item-data>
          
                
          <
quote-item-id>1</quote-item-id>
          
            
        </
merchant-private-item-data>
      </
item>
    </
items>
    <
merchant-private-data>
      
                
      <
quote-id>1</quote-id>
      
            
    </
merchant-private-data>
  </
shopping-cart>
  <
buyer-id> <<myid>> </buyer-id>
  <
calculate>
    <
addresses>
      <
anonymous-address id="<<addressID>>">
        <
country-code>US</country-code>
        <
postal-code>75063</postal-code>
        <
city>irving</city>
        <
region>TX</region>
      </
anonymous-address>
    </
addresses>
    <
shipping>
      <
method name="Shipping - Table Rate" />
    </
shipping>
    <
tax>true</tax>
    <
merchant-code-strings />
  </
calculate>
  <
buyer-language>en_US</buyer-language>
</
merchant-calculation-callback>

 
Magento Community Magento Community
Magento Community
Magento Community
 
enru
Jr. Member
 
Total Posts:  12
Joined:  2008-06-16
 

My fix is to make sure an SSL Callback URL gets sent to Google. Sounds like the last 2 posts are HTTP Auth related. I’m guessing having read the rest of this thread - that it might be PHP/CGI related.

FYI. My bug fix introduced a new bug. HTTPS URLs were not getting set in the Admin panel + perhaps elsewhere. Sorry, Only been using Magento for a week or 2. => I’ve updated the getBaseUrl() Method in my original post.

http://www.magentocommerce.com/boards/viewthread/5960/P75/#t49146

 
Magento Community Magento Community
Magento Community
Magento Community
 
paragon_chase
Jr. Member
 
Total Posts:  19
Joined:  2008-07-30
 

so i’ve run into the 0.00 shipping problem with Google Checkout.  i’ve tried following what Serge & Mike were talking about earlier in this thread, but now when i click the GoogleCheckout button, it hangs up for a while and then takes me to a secure page that says my shopping cart is empty.  from there, i can click on “My Cart” which takes me to an unsecure page that displays the cart contents and has the following error message:

Google Checkout: Error parsing XML; message from parser is: cvc-datatype-valid.1.2.1: ‘[https://SECURESITEURL/googlecheckout/api’ is not a valid value for ‘anyURI’.

can anyone point out to me where i might be going wrong?
thanks in advance for any help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
paragon_chase
Jr. Member
 
Total Posts:  19
Joined:  2008-07-30
 

anyone?

 
Magento Community Magento Community
Magento Community
Magento Community
 
paragon_chase
Jr. Member
 
Total Posts:  19
Joined:  2008-07-30
 

well now i have gone back and replaced all the mod-ed files with the original ones to start over.
is there a quick rundown/summary/step-by-step guide of how to get rid of the $0.00 shipping problem?

i feel there are too many issues being addressed in this thread and using all the different bits and pieces might be causing things to not function properly.

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

This poses a slight security threat, but the only thing I have to do is:

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;
    
}

Then the obvious… [configure] Magento Admin > System > Configuration > Google API > Google Checkout
Also, go to checkout.google.com > Settings > Integration >
API callback URL: https://SECURE_SITEURL/googlecheckout/api

Jbeal’s fix doesn’t seem to be required for the latest version of Magento.

Everything works!

 
Magento Community Magento Community
Magento Community
Magento Community
 
paragon_chase
Jr. Member
 
Total Posts:  19
Joined:  2008-07-30
 

thanks so much!
seems to be working at the moment.

first time it’s showing more than zeros.

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

I’m glad to see you got it working! smile

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

With version 1.1.3, All you have to do is:

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;
        
}

Then the obvious… [configure] Magento Admin > System > Configuration > Google API > Google Checkout
Also, go to checkout.google.com > Settings > Integration >
API callback URL: https://SECURE_SITEURL/googlecheckout/api

You no longer need to modify “googleresponse.php”
Jbeal’s fix doesn’t seem to be required for the latest version of Magento.

Everything works!

 
Magento Community Magento Community
Magento Community
Magento Community
 
barrmy
Sr. Member
 
Avatar
Total Posts:  102
Joined:  2008-06-03
 

this seems to be working great for me as well on 1.1.3!! shipping was passed on perfectly, and order returns to console!!

does it pose a security risk in any way?

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

Yes, it does pose a slight security risk because it removes the HTTP basic authentication.

HTTP Basic Authentication is a scheme designed to allow a client program to provide credentials in the form of a user name and password when requesting a HTTP transaction. However, these credentials are passed over the network as clear text. Therefore, Basic Authentication isn’t considered to be a secure method of user authentication unless accompanied by an external secure system such as SSL or TLS.

So, in theory… if someone were to figure out you removed basic authentication then they could find a way to trick it and make your Magento store think that they paid when they really did not. As long as you confirm that you received the payment by logging into google checkout and looking at the orders/payouts tab you won’t have any problems. If your site is rather busy, and you process lots of sales everyday, this could become tedious. It might also be wise to make sure they payed the correct amount in Google Checkout. I believe that it is very unlikely that this will ever happen though.

Hope that gives you a better understanding… other than that, I’m glad it’s working for you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
eliteeternity
Member
 
Avatar
Total Posts:  74
Joined:  2008-07-16
 
etho201 - 13 August 2008 05:12 PM

With version 1.1.3, All you have to do is:

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;
        
}

Then the obvious… [configure] Magento Admin > System > Configuration > Google API > Google Checkout
Also, go to checkout.google.com > Settings > Integration >
API callback URL: https://SECURE_SITEURL/googlecheckout/api

You no longer need to modify “googleresponse.php”
Jbeal’s fix doesn’t seem to be required for the latest version of Magento.


Everything works!

I’m running 1.1.3 and tried this “hack” and it’s still not working. I don’t have SSL or anything, but I was thinking it should work, regardless.
Any support on this issue would be sweet.

 
Magento Community Magento Community
Magento Community
Magento Community
 
eliteeternity
Member
 
Avatar
Total Posts:  74
Joined:  2008-07-16
 

Anybody have any updates or suggestions for this thread?

 
Magento Community Magento Community
Magento Community
Magento Community
 
fsm-corp
Jr. Member
 
Total Posts:  1
Joined:  2008-08-24
 

This might help some people.

I got Google checkout for sandbox to recognize shipping after I enabling the “Allowed Methods” options in the Configuration > Google API > Google Checkout Shipping - Merchant Calculated.  When I tried testing without creating the “Allowed Methods” options I got similar errors to everyone else.  After I matched the settings to the shipping methods allowed in the other section, shipping charges seemed to work.

FYI: I’m still using version 1.1.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
JayKay106
Jr. Member
 
Total Posts:  7
Joined:  2008-08-20
 

Can anyone from the Magento team confirm that this XML parsing issue for Google checkout been resolved for version 1.1.4?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top