In this post I will tell you how to find out if Google has actually reached your callback page, when using the Google Checkout Api.
There are several ways to check that Google is actually getting to your page.
1. Go into the Tools tab, then click on the integration console.
This will tell you if there are any errors that Google encountered trying to get to or run your page.
2. The next best way is to create a test event on your callback page that will fire when ever the page is run. This can be as simple as just writing a line to a text file, in fact using a text write is a good idea as you can write out all responses from Google and make sure are know which information is coming back, and whether it is correct or not.
A sample for this would be as follows
If you write the following into your callback page, a text will be written to a text file, if there is nothing written, Google has not run this page.
Sample 1 - Writing a simple line to a text file
Writes test line to TestFile.txt - TestFile.txt must exist in the same location on your server as you callback page, simple write the code below at the top of your callback page. If nothing is written Google has not reached your page, check the integration console as advised above.
'START OF CODE'
Dim fso, f, FilePath
Set fso = CreateObject("Scripting.FileSystemObject")
FilePath = Server.MapPath(".") & "\TestFile.txt"
Set f = fso2.CreateTextFile(FilePath, True)
f.WriteLine "Testing"
f.close
'END OF CODE'
Sample 2 - Writing Full Google XML response to text file
The following code will write the Google response to a text file called CompleteGoogleResponse.txt, which must exist in the same location as your callback page.
With this code you have two options, you can write it just below the LogMessage ResponseXML line in the sample callback.asp code provided by Google, just remove the last PrivateData and GNum lines.
or you can write it as is into the function called ProcessNewOrderNotification just write the code at the top of this function, and if all is well you will have a file with the full response XML from Google as well as your Google Order Number for this transaction and any private data your may have sent (NOTE remove the private data line if you do not send any in your original transaction), again if nothing is written Google failed to reach your page, check the integration console as advised above.
'START OF CODE'
Dim fso1, f1, FilePath1
Set fso1 = CreateObject("Scripting.FileSystemObject")
FilePath1 = Server.MapPath(".") & "\CompleteGoogleResponse.txt"
Set f1 = fso2.CreateTextFile(FilePath1, True)
f1.WriteLine "GoogleResponse=" & ResponseXml
f1.WriteLine "PrivateData=" & MyPrivateData.xml
f1.WriteLine "GNum=" & GoogleOrderNumber
f1.close
'END OF CODE'
NOTE
It must be said that if the above code is written into your callback page, and the text written to your file is something like GNum= but there is no information after the = sign, then Google has successfully hit your page, but failed to send you any information. Check the integration console as advised above.
I hope this makes sense, if you have any questions or want me to expand on any of this just drop me a comment or send me an email.
Thanks
Sean J Connolly
Visit AJAX Web Development Store
DMS - Document Management, Webmail
BuzzProperties.co.uk - Online Property Sales and Letting
Thursday, 31 July 2008
How to check Google Checkout API has reached your callback page
Subscribe to:
Post Comments (Atom)

2 comments:
Thanks a Lot Mr.Sean J Connolly for posting this very useful contents. I have been searching for this for a long time. Let me check it out. Thank you very much.
---------------------------
Michael
New Way of Advertising
No probs. Thnx for the feedback. If you need help on anything else just let me know.
Post a Comment