Posted on

3 Quick Methods To Diagnose Communication Problems between Magento and Google Checkout

There is a lot going on when Magento actually sends a cart to Google Checkout, even more so if you are using Merchant calculated shipping. As a result lots of things can go wrong, with the merchant calculated shipping callback or with the actual server to server posting of the cart contents.

To help you with diagnosing problems I thought I’d shared my top 3 methods for finding out what is going wrong when Magento and Google Checkout are not communicating properly.

1) The Intergration Console

The first and most obvious place to try is the Google Checkout Intergration Console. As you can see in the screenshot below the console is hidden away in the Tools tab of the main seller dashboard. You’ll find it at the bottom of the left menu.

The Intergration Console is tucked away in the tools tab at the bottom of the left menu.
The Intergration Console is tucked away in the tools tab at the bottom of the left menu.

If the Google callbacks have failed or incorrect XML has been sent to Google you will find a report of the errors here. It is a good idea to keep an eye on the timestamps as you do not want to wind up chasing an old problem. It’s also good to periodically check this console while in production, just in case something starts to go wrong. I found when I upgraded to the latest Magento that the HTTPS callback was failing, but I hadn’t found it during development because I do not use SSL in development environments.

2) Checking the API Callback URL

This might seem obvious but if you are having problems with the API callbacks such as the Merchant Calculated Shipping callback, it really pays to actually make sure the URL you are using is the correct one. The URL will give a 404 response to an HTTP GET (such as wget or simply pasting the URL into a browser) because it responds only to the HTTP POST method. You can try a post quit simply on a command line using the wget tool with the –post-data=X option like this:

ashley@server:~$ wget --post-data=blah YOUR_MERCHANT_CALCULATED_SHIPPING_URL

Your URL is normally of the form:
http[s]://yourdomain.tld/[store directory]/googlecheckout/api/

The https is required in production environments with the non-sandbox Google Checkout and the [store directory] will not be required if your Magento store is installed at the root of your domain.

When you run the above wget command you would expect to see output like this:

HTTP request sent, awaiting response… 200 OK

You should not see output like:

HTTP request sent, awaiting response… 404 Not Found

This should help you to find out if the problem is to do with SSL, your actual URL path or even a simple typo when you entered the settings into the Google Checkout Integration settings page.

3) Checking The Google API Debug Log Table

There is a way to have Magento log all Google Checkout API messages to a database table. You need to first enable Google Checkout debugging in the Magento Configuration screen. You can find this under System>Configuration>Google API>Google Checkout. Set the ‘Debug’ option to Yes to enable XML message logging for all Google Checkout API communication.

The database table messages are logged to is googlecheckout_api_debug. To find the latest message id and then inspect the messages you can use command line SQL like this:

-- To determine the last message id
SELECT MAX(debug_id) FROM googlecheckout_api_debug;
-- Choose values of X under or equal to the max id shown by the query above
SELECT * FROM googlecheckout_api_debug WHERE debug_id = X;

You’ll need to refer closely to the Google Checkout API XML API documentation to find out what the XML API messages mean and why they are causing problems.

Hopefully these 3 diagnostic steps will help you get started when troubleshooting problems between Magento and Google Checkout. Although it can be difficult, it is a powerful combination and a very flexible API so it is worth investing time both getting the API to work and understanding how it works for future implementations.

37 thoughts on “3 Quick Methods To Diagnose Communication Problems between Magento and Google Checkout

  1. What do you recommend doing if you do get the 404 Not Found?

  2. Hi, Ben

    If you are certainly POST’ing data to the URL you gave to Google, and that is returning a 404 then Google will definitely not be able to access the URL. If you are GET’ing the URL then a 404 is normal.

    I’d suggest checking the URL path – if you are comfortable with providing it here, then paste it and I’ll check it against the physical location of your store. Also, it seems obvious, have you got Google Checkout enabled in your Magento configuration?

    Cheers,
    Ashley

  3. Hi Ashley,

    I am having a pretty tricky time getting Google Checkout to behave properly. I believe I have everything configured right, (I certainly may not), it seems that it has separate issues with UPS and USPS. The general problem is that Magento estimates the shipping prices accurately, but Google Checkout’s pricing of it is about 10-35% less than the actual charge! Ever experience that or have any thoughts? If you think it may be a quick fix, I’d love to pay you to help if you’re open to that.

  4. Hi, Justin

    Thanks for contacting me, I’ll email you directly to discuss how I could help you. Regarding the pricing difference, it’s a tricky one. The Magento shipping is calculated by calling webservices provided by the carriers (eg. UPS). If you have Google carrier-calculate shipping too, then it simply calls those web services as well. Google must be doing slightly different (arguably wrong) calculations. One option is to have Google contact your Magento to ask a shipping price (called ‘merchant calculated shipping’), but I’m not sure if you can then ‘cascade’ those Google calls so that Magento asks UPS/USPS. If you can’t cascade the calls then what you can do is simply have a table of shipping rates in Magento which both Magento and Google checkout share. It won’t be as accurate as asking for a direct quote from the carriers, but at least it’ll give your customers consistency – and you can price it so that you don’t end up out of pocket.

    Cheers,
    Ashley

  5. How exactly do you do the HTTP POST method? Where do you enter the code you suggest and where will the output be found?
    https://buywine.co.il/googlecheckout/api/

    My Gcheckout logs tell me the HttpAuthentication is failing. What folder do I post the php.ini folder into? Ive tried everything and dont know what to do?!?!

  6. Hi, Jon

    The wget program can be run on the command line(terminal) of Linux or Mac computers, on Windows I think you’ll need to install Cygwin to do it. I have run it for you to save any hassle and this is the result:
    ERROR: Certificate verification error for buywine.co.il: unable to get local issuer certificate

    So there is a problem with your SSL that will be causing Google Checkout to fail when in production (during development you do not need SSL so you would be ok testing in the sandbox).

    I see your certificate is from GoDaddy, I understand they can be tricky to set up. I’d suggest having a google around for GoDaddy SSL configuration tutorials, if all else fails post back here some of the details of you setup or contact me and I might be able to write up a tutorial on the subject for you.

    Cheers,
    Ashley

  7. Please help me diagnose my SSL problem between Google Checkout and Magento.

    Thank you,

    Travis King
    TNTRide

  8. I’ve had issues with Google Checkout and Magento. I made a good end run around the issue because the Google callback was always requesting an unsecure URL. I added a line to my .htaccess forcing requests for the unsecure page to route to the secure version. Presto…GC now works. This may have been fixed in a more recent version. If you still have the issue…try this.

    Rules Follow:

    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{REQUEST_URI} googlecheckout/api
    RewriteRule ^(.*)$ https://www.domain.com/googlecheckout/api/$1 [R,L]

  9. I am having a devil of a time getting Google Checkout to return carrier calculated shipping. At first, I was getting a 401 error but my webhost worked on the problem and now I am getting a 200 OK when going the wget.

    However, when I look at the Google checkout debug log, I am getting an http authentication error.

    If I complete the transaction, Google and Magento are communicating for everything else.

    Any ideas?

    Thanks,

    Donna

  10. Hello,
    I am trying with Google Checkout but still can not figure it out to work.
    I found under Integration Console of Google checkout this error:
    “We timed out waiting for your server at http://dev.goldsakura.com/english/googlecheckout/api/ — the error we got is: Read timed out. Your server must respond faster to merchant calculation callback requests.”
    Can you give me advice for this?
    Thanks,
    Neo.

  11. Hi, The error itself is pretty self explanatory, your server is responding too slowly. You could throw some logging in the Magento GC code to see if the time is being taken in there or in transit between your server and GC. Does this happen 100% of the time or only intermittently? I know from experience I had a couple of days where this happened more than once, and I put it down to some intermittent network issues. Are you using table rates, or carrier calculations via Magento? If the latter, that could be the slow point. If it’s not network, and it’s not 3rd party carriers, then you may need a faster server too? Let me know more details.

  12. In my tests with wget I get 503 always
    20:31:47 ERROR 503: Service Unavailable.
    First it redirects me with a 302 to /shop/report/?id=XXXXXXXXXX
    then the 503 comes. Is that normal ? Are you sure you guys are getting a 200 ?

  13. Hi,
    The 302 is a temporary redirect to /shop/report. The /shop/report url is where you get sent when Magento catches and error and shows the error screen. You can actually tell what the error was by looking in var/report at the file with the name XXXXXX. The 503 is the response code sent by the report page (because an error occurred). Without seeing the report file, I’d guess there is an error in your Google Checkout code somewhere. Post the stack trace and we can take a look.

    Cheers,
    Ashley

  14. Any suggestions for if you get a 404 error using wget to test? Our SSL certificate appears to be setup OK for normal checkout / account admin, so I don’t think it’s that.

  15. Are you doing a GET or POST request?

  16. Post. I tried the wget command you gave above (except replaced YOUR_MERCHANT_CALCULATED_SHIPPING_URL with https://www.mydomain.com/base_path/index.php/googlecheckout/api). The Magento wiki page on Google Checkout integration says to make sure always_populate_raw_post_data = On in php.ini, which it is. Any ideas?

  17. That’s a weird one then. Just sanity check yourself with a wget (GET) on:
    https://www.mydomain.com/base_path/

  18. Glad to hear it, I was a little suspicious that would be the case.

  19. This is a very informative method of diagnosing Google Checkout problems. Thank you!

    I seem to be having problems with step one – the “API Callback URL”. After initiating a SSH login, I issued the following commands:

    wget –post-data=blah https://fcpaparts.com/googlecheckout/api/
    –server responded with “401 Unauthorized
    Authorization failed.”

    wget –post-data=blah https://fcpaparts.com/index.php/googlecheckout/api/
    –server responded with “401 Unauthorized
    Authorization failed.”

    However, when I the following command at the base URL:
    wget –post-data=blah https://fcpaparts.com
    –server responded with “200 OK”

    I suspect the problem is the format or access to the path:
    https://www.mydomain.com/googlecheckout/api
    So, I checked the directory permissions for the “js” directory and all values are set to 775.

    Additionally, I’ve “triple-checked” my settings for “Google merchant ID”, “Google merchant key”, and implemented the suggestion on this site entitled “Magento 1.2.0.1 Fails when using Google Checkout Merchant Calculated Shipping Callbacks: An HTTPS URL is required.” Still, not working:(

    I’ve put Magento on the side-burner for months, because of my frustration with the Google Checkout errors. I feel that I’m very close to fixing this problem: Anyone’s comments/suggestions would be appreciated.

    Running Magento 1.3.2.4

  20. Hi, Something is telling your server to 401 that request and I’m not sure why. Another commenter above says they were getting 401 errors and their host resolved them – but I cannot think why that would be. Perhaps try just a totally vanilla Magento with no code changes, no anything (not even https) and try to get that to work by POST’ing to the URL.

  21. When checking with wget I have a 11:12:41 ERROR 503: Service Unavailable.
    So checkinv var/report I see my debug file there showing that
    I have a invalid offset in the line 103 over googleresponse.php.
    Is anybody having the same issue ?

    a:2:{i:0;s:105:”Notice: Undefined offset: 1 in /var/www/web1/web/shop/lib/googlecheckout/googleresponse.php on line 103″;i:1;s:1170:”#0 /var/www/web1/web/shop/lib/googlecheckout/googleresponse.php(103): mageCoreErrorHandler(8, ‘Undefined offse…’, ‘/var/www/web1/w…’, 103, Array)

  22. I am getting the above error—the error in line 103 with the wget call! I cant tell if thats just cause I’m trying a fake call or if there’s really a problem (eg perhaps HTTP AUTH not enabled).

    Grr Magento! I bet this issue is fixed in the $13K Enterprise edition…

  23. It’s been a while since I have played around with that area of GC, what error are you getting in the integration console? And don’t bet on it 🙂

  24. Great information on the site. We are having trouble with the integrating Magento and Google Checkout.

    The customer is able to make a purchase using google checkout (money goes into the account).
    However, the data for the order does not go back into Magento; no data at all.

    In addition when a customer uses Google Checkout information for the product is missing; size, customization (name and number).

    We currently turned off google checkout but would love some advice.

    Thank you very much,

  25. If the order goes through Google but not into Magento, that normally means your callback is failing – check your Google integration console. Also the display of product line items in Google Checkout is not that pretty – particularly the discount item, and as you have noted configurable items just show up as the parent, with no configuration detail.

  26. On November 30th you posted above about getting a 503 error when posting to the google checkout api. Here is my error report. Do you know what it means?

    a:2:{i:0;s:106:”Notice: Undefined offset: 1 in /home/wired/www/magento/lib/googlecheckout/googleresponse.php on line 103″;i:1;s:1179:”#0 /home/wired/www/magento$
    #1 /home/wired/www/magento/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php(53): GoogleResponse->HttpAuthentication()
    #2 /home/wired/www/magento/app/code/core/Mage/GoogleCheckout/Model/Api.php(188): Mage_GoogleCheckout_Model_Api_Xml_Callback->process()
    #3 /home/wired/www/magento/app/code/core/Mage/GoogleCheckout/controllers/ApiController.php(31): Mage_GoogleCheckout_Model_Api->processCallback()
    #4 /home/wired/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(376): Mage_GoogleCheckout_ApiController->indexAction()
    #5 /home/wired/www/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch(‘index’)
    #6 /home/wired/www/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controlle$
    #7 /home/wired/www/magento/app/Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
    #8 /home/wired/www/magento/index.php(65): Mage::run()
    #9 {main}”;}

    This bad communication between Google Checkout and my api may explain the error that I’m having. First orders correctly get reported to magento admin however there are no items reported only total price. Second I would like to enable free shipping for orders over x amount and this isn’t working.

    Any help would be appreciated. Thanks.

  27. Thanks! that solved two of my problems!

  28. I’m having the same challenge as Alton. I get a 503 error when doing the wget

  29. I think 503 is expected response to incorrect post data (which it probably will be if testing from wget) in Magento version 1.4+

  30. Hi Ashley

    I have had constant problems with Magento 1.4 & Google checkout intergration, I have a valid SSL cert and to my knowlage the API is setup correctly, the Google order comes to me fine but it doesn’t send the order to the customer or add it into the magento admin.

    My API Callback is: https://www.athema.co.uk/googlecheckout/api/

    Could you advise?
    Thanks

    Daz

  31. @Darren – What are you seeing in the Google checkout integration log?

  32. I have GC in place (along with options for paypal and amazon payments) on a testing site and it seems to work although I have not tested it with many different variable checkout situations.

    i notice on some super big e-comm sites GC will be available on some products and not others.

    I am looking at having some specialty product combos like:

    buy x get y free
    buy x and x get a better y free

    where x-a might be a virtual product and x-b might be a simple product and y might be a t-shirt

    if everything is added up correctly pre-gc is there still a chance of some sot of gc gotcha?

  33. Mostly yes, except when using the merchant calculated callback, then your shipping and tax can be wrong.

  34. Hi Ashley,

    I’m having a terrible time trying to get table rate shipping to work with GC. No matter what I select as my destination country I always get the same value of £2.50 appearing in the cart display of GC. £2.50 isn’t even a table rate value for any country so I’m not sure where it gets this from. I’ve tried uploading my table rate CSV with both 2 and 3 char country codes but no joy (did this because the GC log is showing 2 char codes).

    I can’t make sense of the logs either so I’m really stuck with this one – could you help please?

    I uploaded my GC log files here
    http://www.mediafire.com/?bilj8k0t0zmc144

  35. Uploaded my table rates csv and some screenies of my config and of the problem itself:

    Table Rates CSV: http://www.mediafire.com/?inicpixuv8ba7v2
    Screenies: http://www.mediafire.com/?3k2vl8tgwl3s3qb

  36. Forgot to mention, in GC tools/integration console I see these errors:

    We encountered an error trying to access your server at https://www.sinfulthrills.co.uk/googlecheckout/api/ — the error we got is Error ‘TIMEOUT’ connecting to url ‘https://www.sinfulthrills.co.uk/googlecheckout/api/’.

    BUT the googleerror.log in my var/logs directory is 0 bytes?

Comments are closed.