5

Been working on this for a while and just can't get google to accept that I've done what they want so they keep sending me notifications for the same order. The documentation on this is available here:

Google Notification Acknowledgement Documentation

Here is my code on the page which recieves google notifcations:

 string serial = Request["serial-number"];

 // do my stuff

 StringBuilder responseXml = new StringBuilder();
 responseXml.Append("<?xml version='1.0' encoding='UTF-8'?>");
 responseXml.Append("<notifiation-acknowledgment xmlns=\"http://checkout.google.com/schema/2/\" serial-number=\"");
 responseXml.Append(Request["serial-number"]);
 responseXml.Append("\" />");

 HttpResponse response = HttpContext.Current.Response;
 response.StatusCode = 200;
 response.ContentType = "text/xml";
 response.Write(responseXml.ToString());
Luke Belbina
  • 5,708
  • 12
  • 52
  • 75
  • You should really XML-escape the serial number as you append it. But I can't see anything wrong - maybe try ending with an AppendLine for a line feed? Or omitting the ` – Rup May 17 '11 at 22:33
  • Have you tried just using the GCheckout api for this? It encapsulates the google checkout calls into a library. http://code.google.com/apis/checkout/samples/Google_Checkout_Sample_Code_NET.html#googleCheckoutSampleCodeNETInstallCheckoutModule – briercan May 17 '11 at 23:12
  • 'Note: The .NET sample code distribution does not include classes or methods to process notifications or to send notification acknowledgments.' – Luke Belbina May 18 '11 at 01:09
  • I am using it just yeah, like I said above no examples for notifications and can't find any code to post the correct response. – Luke Belbina May 18 '11 at 01:09
  • Are you doing response.clear() and response.headers.clear() before this code? If not, this could cause problems if in a Page because of the default HTML generated. Also, try using response.end() after the last line to ensure your response stream is flushed to output. – NightOwl888 May 18 '11 at 08:01

1 Answers1

4

You have misspelt "notification-acknowledgment" as "notifiation-acknowledgment".

I would also suggest using GCheckout as briercan said in the comments. If you use that, then all you would have to do is:

var ack = new GCheckout.AutoGen.NotificationAcknowledgment();
ack.serialnumber = serial;
Response.BinaryWrite(GCheckout.Util.EncodeHelper.Serialize(ack));
Response.StatusCode = 200;
David Duffett
  • 3,145
  • 2
  • 26
  • 27