protected void Page_Load(object sender, EventArgs e)
    {
        string serialNumber = null;

        // Receive Request
        Stream requestInputStream = Request.InputStream;

        string requestStreamAsString = null;
        using (System.IO.StreamReader oneStreamReader = new StreamReader(requestInputStream)) {
          requestStreamAsString = oneStreamReader.ReadToEnd();
        }

        // Parse Request to retreive serial number
        string[] requestStreamAsParts = requestStreamAsString.Split(new char[] { '=' });
        if (requestStreamAsParts.Length >= 2) {
          serialNumber = requestStreamAsParts[1];
        }

        // Call NotificationHistory Google Checkout API to retrieve the notification for the given serial number and process the notification
        GoogleCheckoutHelper.ProcessNotification(serialNumber);

        //serialize the message to the output stream only if you could process the message.
        //Otherwise throw an http 500.

        var response = new GCheckout.AutoGen.NotificationAcknowledgment();
        response.serialnumber = serialNumber;

        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.BinaryWrite(GCheckout.Util.EncodeHelper.Serialize(response));
    }
        /// <summary>
        /// Get notification acknowledgment text
        /// </summary>
        /// <returns>Notification ack</returns>
        public string GetNotificationAcknowledgmentText()
        {
            var gNotificationAcknowledgment = new NotificationAcknowledgment();

            var sb = new StringBuilder();
            using (var sw = new StringWriter(sb))
            {
                var serResponse = new XmlSerializer(gNotificationAcknowledgment.GetType(), "http://checkout.google.com/schema/2");
                serResponse.Serialize(sw, gNotificationAcknowledgment);
            }

            return sb.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string serial = Request["serial-number"];
            serial = serial.Replace("serial-number=", "");

            GCheckout.OrderProcessing.NotificationHistorySerialNumber ser = new GCheckout.OrderProcessing.NotificationHistorySerialNumber(serial);
            GCheckout.OrderProcessing.NotificationHistoryRequest histroey = new GCheckout.OrderProcessing.NotificationHistoryRequest("417255259260942", "LzWjnZDmrxRiA0UlIUfeSg", GCheckout.EnvironmentType.Sandbox.ToString(), ser);

            GCheckout.Util.GCheckoutResponse responce = histroey.Send();

            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml(responce.ResponseXml);

            SqlConnection cn = new SqlConnection("Data Source=fbcmsdatabase.db.8886533.hostedresource.com;Initial Catalog=fbcmsdatabase;User ID=fbcmsdatabase;Password=H1v3bu1ld3r");
            cn.Open();
            SqlCommand cmd = new SqlCommand("insertpaypal", cn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@date", DateTime.Now.ToString()));
            cmd.Parameters.Add(new SqlParameter("@text", responce.ResponseXml));
            cmd.Parameters.Add(new SqlParameter("@respond", Context.Request.ServerVariables["REMOTE_ADDR"].ToString()));
            cmd.ExecuteNonQuery();
            cn.Close();

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