【问题标题】:Google checkout notification acknowledgment failingGoogle 结帐通知确认失败
【发布时间】:2012-06-24 12:19:52
【问题描述】:

我有一个被调用的回调 url,我可以处理它。但是 - Google 不会处理我的确认。这些都在EnvironmentType.Sandbox

在 Google 结帐“集成控制台”中,我收到以下消息:

我们在处理您的通知确认时遇到错误。 我们得到的错误是:解析通知确认时出错。

详情如下: 他们发给我的内容:serial-number=...

他们收到了什么:

<?xml version="1.0" encoding="utf-8"?>
<notification-acknowledgment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" serial-number="here is the same serial number they sent me" xmlns="http://checkout.google.com/schema/2" />

<!DOCTYPE html...

我正在使用的代码:

GCheckout.AutoGen.NotificationAcknowledgment response = new GCheckout.AutoGen.NotificationAcknowledgment();
response.serialnumber = serialNumber;
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.BinaryWrite(GCheckout.Util.EncodeHelper.Serialize(response));
HttpContext.Current.Response.StatusCode = 200;

这里有什么错误?

【问题讨论】:

    标签: c# asp.net google-checkout


    【解决方案1】:

    请参阅.Net Library examples 中的“代码隐藏”代码

    如果您使用的是 aspx 文件,请删除其中的所有 HTML 内容,如 aspx source of the same example 所示

    Response.End() 也将起作用,因为它会阻止任何进一步的响应内容被返回(实际上是做同样的事情 - 阻止发送 Web 表单(aspx 文件)中的 HTML 内容)。

    您还可以考虑使用通用处理程序 (ashx) 而不是 aspx 页面作为回调 url。

    【讨论】:

      【解决方案2】:

      这个问题似乎可以通过回答我的另一个问题来解决:How can I create an http response from scratch?

      解决方法是添加:

      HttpContext.Current.Response.End();
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-03
        • 2014-01-04
        相关资源
        最近更新 更多