0

I'm trying to send Google Checkout a Notification Acknowledgement once I receive a serial number so it would know that I've already handled this serial number and saved it to my database. But I keep getting the following error in the integration console:

We encountered an error processing your notification acknowledgment. The error we got is: Error parsing notification acknowledgment.

When I check the value being sent to the server, everything seems to look fine to me:

<notification-acknowledgement xmlns="http://checkout.google.com/schema/2" serial-number="357304636821412-00001-7" />

Here's my code:

    [HttpPost]
    public EmptyResult Notify()
    {
        var serial = Request["serial-number"];
        var data =
            "<notification-history-request xmlns=\"http://checkout.google.com/schema/2\"><serial-number>" + serial + "</serial-number></notification-history-request>";
        var serverResponse = _checkoutService.Post(data, GoogleCheckoutConstants.ReportsUri);

        //Send me email to checkout the response
        dynamic email = new Email("CheckoutLog");
        email.Response = serverResponse;
        email.Send();

        var acknowldgement =
            "<notification-acknowledgement xmlns=\"http://checkout.google.com/schema/2\" serial-number=\"" + serial +
            "\" />";

        HttpResponse response = System.Web.HttpContext.Current.Response;
         response.StatusCode = 200;
         response.ContentType = "text/xml";
        response.Write(acknowldgement);
        return null;
    }

Moreover, why do I keep receiving new-order-notification only? What's more important to me is the authorization-amount-notification, but it never sends it although in the Documentation Section 2, Step 2.1 it says that after some time it should send me this notification. Am I missing something here?

1
  • Did you try Response.Flush()?
    – joe.feser
    Jun 28, 2011 at 13:58

3 Answers 3

2

Seems you are missing xml declaration(?)

**<?xml version="1.0" encoding="utf-8"?>**
<notification-acknowledgment serial-number="the-serial-no" xmlns="http://checkout.google.com/schema/2" />

Other things that could also affect it (guess based only on the above):

  • an exception in your call to _checkoutService.Post
  • an exception in your call to email.Send()

It might be better if you first store the serial # (so you "always" have it), and then do whatever else you need to do (i.e. send the notification history request, parse, send email, etc.).

The idea of the acknowledgement is for you to acknowledge successful receipt of the serial number. Once you have the serial number you can perform notification history request(s) whenever you need to (i.e. if you have issues parsing you can always resend over and over until you can parse successfully).

Hope this helps....

0

Why are you not using the .Net library that was already built for Google Checkout.

See this for more info.

http://code.google.com/p/google-checkout-dotnet-sample-code/

3
  • 1
    I actually thought about this. I even installed the library in my project but then I couldn't find out how to use it with ASP.NET MVC. It seems to rely on a GC button control and as you might know, controls are not available for ASP.NET MVC. Have you thought of porting the library to ASP.NET MVC? I think rather than using a control, you would use an HTML helper, but I'm not really sure that would do it because I do not know the inner workings of the library.
    – Kassem
    Jun 27, 2011 at 21:10
  • 1
    Internally the button just knows how to create an instance of the GCheckoutRequest. Please log an issue and I can create one for mvc but the use of the button is NOT needed. See the code samples, it will save you hours of time.
    – joe.feser
    Jun 28, 2011 at 13:51
  • You can also put in a feature request on the site with samples on how you think the helper should be formatted and I can add it to the library.
    – joe.feser
    Jun 28, 2011 at 13:56
0

You also need to make sure that you are referring to the correct API version in the documentation and the sample code. I was looking at two different versions and it was confusing me big time. If you are using the api version 2.5 checkout out this post.

http://www.capprime.com/software_development_weblog/2010/11/29/UsingTheGoogleCheckout25APIWithASPNETMVCTheMissingSample.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.