紧急求助啊!!
我的网站想和paypal集成,不是国内的贝宝,而是paypal。
我现在已经在我的网站上放了一个按钮,并且可以正常购买东西。我用的buyer账号购买东西,然后用seller账号登陆,已经可以看到正常收到钱了。但是有一个很大的问题,就是我的网站无法正确接收到付款信息,无法存入数据库。
我先说说我的步骤,大家帮帮忙吧:1、我的测试页面代码,仅aspx页面有代码,cs页面为空<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
   <input type="hidden" name="cmd" value="_xclick">
   <input type="hidden" name="business" value="[email protected]">
   <input type="hidden" name="item_name" value="Item Name Goes Here">
   <input type="hidden" name="item_number" value="Item Number Goes Here">
   <input type="hidden" name="amount" value="20.00">
   <input type="hidden" name="no_shipping" value="2">
   <input type="hidden" name="no_note" value="1">
   <input type="hidden" name="currency_code" value="USD">
   <input type="hidden" name="bn" value="IC_Sample">
   <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" name="submit" alt="Make payments with payPal - it's fast, free and secure!">
   <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
2、paypal官方有两个地方设置返回页面,第一个是“即时付款通知习惯设定”也就是“Instant Payment Notification Preferences ” 我的返回页面设置为Notification URL:ipn.aspx。Message deliveryEnabled。这个设置应该没有问题吧?我的ipn代码为,aspx页面就是几个框,不提了。cs页面如下:public partial class ipn : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (VerifyIPN())//验证成功
        {
            string ppTx = Request.Form["txn_id"].ToString();
            string ppStatus = Request.Form["payment_status"].ToString();
            string ppDate = Request.Form["payment_date"].ToString();
            string ppItem = Request.Form["item_name"].ToString();
            string ppPrice = Request.Form["mc_gross"].ToString();
            this.TextBox1.Text = ppTx;
            this.TextBox2.Text = ppStatus;
            this.TextBox3.Text = ppDate;
            this.TextBox4.Text = ppItem;
            this.TextBox5.Text = ppPrice;
            HttpCookie cookie = new HttpCookie("Info");//定义cookie对象以及名为Info的项
            DateTime dt = DateTime.Now;//定义时间对象
            TimeSpan ts = new TimeSpan(1, 0, 0, 0);//cookie有效作用时间,具体查msdn
            cookie.Expires = dt.Add(ts);//添加作用时间
            cookie.Values.Add("ppTx", ppTx);//增加属性
            cookie.Values.Add("ppStatus", ppStatus);
            cookie.Values.Add("ppDate", ppDate);
            cookie.Values.Add("ppItem", ppItem);
            cookie.Values.Add("ppPrice", ppPrice);
            Response.AppendCookie(cookie);//确定写入cookie中         读取cookie
        } 
        else
        {        }
    }
    //////////////////////////////////////////////////////////////////////////
    bool VerifyIPN()
    {
        string strFormValues = Request.Form.ToString();
        string strNewValue;
        string strResponse;
        string serverURL = "https://www.sandbox.paypal.com/cgi-bin/webscr";        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(serverURL);
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        strNewValue = strFormValues + "&cmd=_notify-validate";
        req.ContentLength = strNewValue.Length;        StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
        stOut.Write(strNewValue);
        stOut.Close();        StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
        strResponse = stIn.ReadToEnd();
        stIn.Close();        return strResponse == "VERIFIED";
    }
}
3、paypal还有一个设置,“Website Payment Preferences ”,“网站付款习惯设定”。我这里设置的是:自动返回: 开启。返回 URL:OK.html。我的ok.html代码:<body>
    <p>
        That&#39;s OK!</p>
</body>
以上就是全部设置了,我测试的过程是这样的,首先点击购买按钮,然后跳到paypal去,然后输入测试账号付款,然后系统调到这么一个url:http://www.cgunited.com/OK.html?tx=3G514512SP293070L&st=Pending&amt=20.00&cc=USD&cm=&item_number=Item Number Goes Here
页面显示的内容是:That's OK!我登陆paypal发现付款成功了,但是为何我的cookie里面却没有写入任何信息呢?

解决方案 »

  1.   

    我的理解是这样的:IPN返回页面,应该是不显示给用户,仅仅用于接收数据,并保存到数据库里面。
    而OK页面用户简单的告诉用户购买了什么产品,购买成功与否还有可以告诉用户一些使用注意事项等等。但是为何我的IPN页面接收不到数据啊
      

  2.   

    ipn 的Page_load被调用了吗.
    参考http://www.chenchen.org/article/10.htm
    看看是不是有步骤漏掉了.
      

  3.   

    你好 你现在集成的方式应该是PayPal的标准版也就是wps的版本,所以所有的付款数据之类的信息都还是保留在PayPal网站里面而不是你的网站后台。现在ecs也就是专业版的继承方案士可以实现你的的想法但是却无法收取信用卡的付款,如果关于PayPal方面的集成需要我们官方的技术人员跟您沟通的话 
     
    请发邮件到
      

  4.   

    弱弱的问下,请问假如你购买多个商品的时候item_name和amout如何设置呢?
      

  5.   

    https://www.sandbox.paypal.com/cgi-bin/webscr 这个地址能测试返回值吗?好像没有设置的地方啊?
      

  6.   

    没人回复啊有人知道的话告诉我啊 我的没有返回值,付款完后,就停在了自己付款paypal账户那里。而且,也没返回信息,更没有做我网站支付状态数据库字段的处理!