首页 新闻 会员 周边 捐助

IPN 方式失败

0
[待解决问题]

提交页面:

 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
                                <input type="hidden" name="cmd" value="_xclick">
                                <input type="hidden" name="business" value="XXXXX">
                                <input type="hidden" name="item_name" value="<%=LinkCode%>">
                                <input type="hidden" name="amount" value="<%=SubPrice %>">
                                <input type="hidden" name="currency_code" value="USD">
                                <input type="hidden" name="lc" value="US">
                                <input type="image" src="Images/x-click-but23.gif" border="0"
                                    name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
                                </form>

paypal 设置页面


 

http://10.0.100.100/PSEN/zhifu/return_url.aspx 页面

 

protected void Page_Load(object sender, EventArgs e)
    {
        //Post back to either sandbox or live
        string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
        string strLive = "https://www.paypal.com/cgi-bin/webscr";
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);
        //Set values for the request back
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
        string strRequest = Encoding.ASCII.GetString(param);
        strRequest += "&cmd=_notify-validate";
        req.ContentLength = strRequest.Length;

        //WebProxy proxy = new WebProxy(new Uri("http://url:port#"));
        //req.Proxy = proxy;

        //Send the request to PayPal and get the response
        StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
        streamOut.Write(strRequest);
        streamOut.Close();
        StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
        string strResponse = streamIn.ReadToEnd();
        streamIn.Close();

        if (strResponse == "VERIFIED")
        {
            string item_name = Request.Form["item_name"].ToString();//获取post中的各项变量值
            UserOrder order = UserOrderDAL.m_UserOrderDAL.GetModel(string.Format("OrderCode='{0}'", item_name)); 
order.IsPay
= 1;
order.Status
= 2;
UserOrderDAL.m_UserOrderDAL.Update(order);
}
}
icbase的主页 icbase | 初学一级 | 园豆:93
提问于:2012-10-29 09:49
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册