Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Google Checkout - API Callback URL - Error - Failed to Get Basic Authentication
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

Maybe I am not doing this correctly, but I can’t seem to get this to work. I looked at the wiki for Google Checkout and followed it exactly. I have SSL enabled on my site… and I entered the API Callback URL as: https://secure.omnivariety.com/googlecheckout/api

Then when I look at my integration console in google checkout I keep getting the following error.

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

Then it says, “XML We Sent:” with the following code.

<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-callback xmlns="http://checkout.google.com/schema/2" serial-number="f684380d-r2d2-456d-a8b1-f3ad3f2bb5b1">
  <
shopping-cart>
    <
items>
      <
item>
        <
item-weight value="2.0" unit="LB" />
        <
tax-table-selector>2</tax-table-selector>
        <
item-name>Sample Product B</item-name>
        <
item-description></item-description>
        <
quantity>1</quantity>
        <
unit-price currency="USD">29.95</unit-price>
        <
merchant-item-id>10123-Blue-Medium</merchant-item-id>
        <
merchant-private-item-data>
          
                
          <
quote-item-id>299</quote-item-id>
          
            
        </
merchant-private-item-data>
      </
item>
    </
items>
    <
merchant-private-data>
      
                
      <
quote-id>69</quote-id>
      
            
    </
merchant-private-data>
  </
shopping-cart>
  <
buyer-id>371336154727225</buyer-id>
  <
calculate>
    <
addresses>
      <
anonymous-address id="361827037938980">
        <
country-code>US</country-code>
        <
city>Charleston</city>
        <
region>SC</region>
        <
postal-code>29404</postal-code>
      </
anonymous-address>
    </
addresses>
    <
shipping />
    <
tax>true</tax>
    <
merchant-code-strings />
  </
calculate>
  <
buyer-language>en_US</buyer-language>
</
merchant-calculation-callback>

Any ideas on how to fix that? :?

 Signature 

http://www.omnivariety.com

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

 Signature 

http://www.omnivariety.com

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
53185 users|737 users currently online|107214 forum posts