The ResponseHandler.asp page demonstrates a simple implementation of a page that processes Google Checkout API responses. This page provides core functionality needed to handle Google Checkout's responses to Checkout API requests. It also provides a template for handling Merchant Calculations and Notification API responses.
ResponseHandler.asp captures the XML in a Google Checkout API response and then sends that XML to the ProcessXmlData function. That function then analyzes the root tag of the XML response to determine what type of message is contained in the XML. Depending on the type of message contained in the XML, ProcessXmlData will route the XML response to another function in either ResponseHandlerAPIFunctions.php, MerchantCalculationsAPIFunctions.php or NotificationAPIFunctions.php.
To adapt the ResponseHandler.asp implementation for use in your site, you will need to modify the functions in the library files to relay the information from Google Checkout API responses to your internal systems that process that data. For partners who are only implementing the Checkout API, this may require little or no effort.
Partners who are also implementing the Merchant Calculations API will need to modify the appropriate functions in MerchantCalculationsAPIFunctions.php to calculate tax, shipping and discounts for an offer and to return a <merchant-calculation-results> response.
Partners who are also implementing the Order Processing and Notification APIs will need to modify the appropriate functions in NotificationAPIFunctions.php to properly handle and store data about order notifications.
<!--#INCLUDE file="ResponseHandlerAPIFunctions.asp"-->
<%
' Define objects used to process Google Checkout response
Dim xmlResponse
Dim xmlAcknowledgment
' Retrieve the XML sent in the HTTP POST request to the ResponseHandler
Dim biData
biData = Request.BinaryRead(Request.TotalBytes)
Dim nIndex
For nIndex = 1 to LenB(biData)
xmlResponse = xmlResponse & Chr(AscB(MidB(biData,nIndex,1)))
Next
' Log the XML received in the HTTP request
logMessage logFilename, xmlResponse
' Call the processXmlData function, which is defined in
' ResponseHandlerAPIFunctions.asp. The processXmlData will route
' the XML data to the function that handles the particular type
' of XML message contained in the POST request.
processXmlData(xmlResponse)
%>
