Google Checkout Notification API
Posted: Sat Oct 23, 2010 4:08 am
Hi guys,
I'm trying to integrate my site with the google checkout api and am having a little difficulty understanding the documentation. I understand that I need to have a URL that the API can send a serial number to, but i'm not sure of the format exactly. Is it a post? Additionally, how do I return an http response code as well as the serial number of the notification? Do I just send a raw header and echo the serial number?? I would very much appreciate it if anyone could point me in the right direction:
url: http://code.google.com/apis/checkout/de ... ifications
Responding to the Serial Number Notification
When your web application receives the serial number notification from Google, the application should attempt to parse and process the notification.
Using a notification handshake to confirm successful processing
The following guidelines explain how to respond to notifications using a process that enables Google to more reliably confirm that you successfully processed a notification.
If your application parses and processes a notification successfully, the application needs to return an HTTP 200 response code as well as the serial number of the notification. You can parse this value from the notification's serial-number attribute. Together, the response code and the serial number signify that you received the notification and processed it successfully. Google will not resend a notification after receiving this type of response.
To return the serial number in your HTTP response, send a <notification-acknowledgment> response. In that response, set the value of the <notification-acknowledgment> tag's serial-number attribute to the serial number of the notification.
The following examples demonstrate how to identify and return the serial number for a notification. Example 1 shows how the serial number would be conveyed in a serial number notification Example 2 shows a <notification-acknowledgment> with the same serial number. In both examples, the serial number is shown in bold text.
Example 1:
serial-number=134827144342486-00001-7
Example 2:
<notification-acknowledgment xmlns="http://checkout.google.com/schema/2"
serial-number="134827144342486-00001-7" />
If your application is unable to parse or process the notification, the application should return either a 4xx or 5xx response code (500, 501, etc.). These response codes indicate that your server has experienced an error or is incapable of performing the request. Please note that your application should return an error response code even in cases when you know the notification will continue to fail.
If you opt to use this feature, then you must return an HTTP 200 response code and the serial number for a successfully processed notification. Otherwise, Google will try to resend the notification, in accordance with our retry policy, for up to 14 days. Specifically, Google will resend a notification if you send any of the following responses to a notification:
An HTTP 4xx or 5xx response code. (Google recommends this response for a notification that is not handled successfully.)
An HTTP 200 response code that does not include the serial number of the processed notification.
Any other HTTP 2xx or 3xx response code.
I'm trying to integrate my site with the google checkout api and am having a little difficulty understanding the documentation. I understand that I need to have a URL that the API can send a serial number to, but i'm not sure of the format exactly. Is it a post? Additionally, how do I return an http response code as well as the serial number of the notification? Do I just send a raw header and echo the serial number?? I would very much appreciate it if anyone could point me in the right direction:
url: http://code.google.com/apis/checkout/de ... ifications
Responding to the Serial Number Notification
When your web application receives the serial number notification from Google, the application should attempt to parse and process the notification.
Using a notification handshake to confirm successful processing
The following guidelines explain how to respond to notifications using a process that enables Google to more reliably confirm that you successfully processed a notification.
If your application parses and processes a notification successfully, the application needs to return an HTTP 200 response code as well as the serial number of the notification. You can parse this value from the notification's serial-number attribute. Together, the response code and the serial number signify that you received the notification and processed it successfully. Google will not resend a notification after receiving this type of response.
To return the serial number in your HTTP response, send a <notification-acknowledgment> response. In that response, set the value of the <notification-acknowledgment> tag's serial-number attribute to the serial number of the notification.
The following examples demonstrate how to identify and return the serial number for a notification. Example 1 shows how the serial number would be conveyed in a serial number notification Example 2 shows a <notification-acknowledgment> with the same serial number. In both examples, the serial number is shown in bold text.
Example 1:
serial-number=134827144342486-00001-7
Example 2:
<notification-acknowledgment xmlns="http://checkout.google.com/schema/2"
serial-number="134827144342486-00001-7" />
If your application is unable to parse or process the notification, the application should return either a 4xx or 5xx response code (500, 501, etc.). These response codes indicate that your server has experienced an error or is incapable of performing the request. Please note that your application should return an error response code even in cases when you know the notification will continue to fail.
If you opt to use this feature, then you must return an HTTP 200 response code and the serial number for a successfully processed notification. Otherwise, Google will try to resend the notification, in accordance with our retry policy, for up to 14 days. Specifically, Google will resend a notification if you send any of the following responses to a notification:
An HTTP 4xx or 5xx response code. (Google recommends this response for a notification that is not handled successfully.)
An HTTP 200 response code that does not include the serial number of the processed notification.
Any other HTTP 2xx or 3xx response code.