C#ASP.NET Google Checkout通知确认

时间:2011-05-17 21:30:08

标签: c# asp.net google-checkout

已经有一段时间了,只是无法让谷歌接受我已经做了他们想要的事情,所以他们不断向我发送同一订单的通知。有关此文档的文档可在此处获取:

Google Notification Acknowledgement Documentation

以下是接收Google通知的网页上的代码:

 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());

1 个答案:

答案 0 :(得分:4)

你有拼错“通知 - 确认”为“通知 - 确认”。

我还建议使用GCheckout作为briercan在评论中说。如果你使用它,那么你所要做的就是:

var ack = new GCheckout.AutoGen.NotificationAcknowledgment();
ack.serialnumber = serial;
Response.BinaryWrite(GCheckout.Util.EncodeHelper.Serialize(ack));
Response.StatusCode = 200;