入门和Paypal集成(C#)

入门和Paypal集成(C#),paypal,Paypal,我正在使用MVC和C#定制购物车,并试图将其集成到paypal中。我已经迷失在贝宝如此多的不同选择中。是否有简单的资源来解释基本知识?我尝试使用下面的代码,但失败了,但没有错误代码。我真的不明白集成是如何工作的,文档涵盖了这么多不同的安排,我发现这相当困难。贝宝说我应该在这个论坛上发帖 string authToken = WebConfigurationManager.AppSettings["PDTToken"]; //read in txn token from quer

我正在使用MVC和C#定制购物车,并试图将其集成到paypal中。我已经迷失在贝宝如此多的不同选择中。是否有简单的资源来解释基本知识?我尝试使用下面的代码,但失败了,但没有错误代码。我真的不明白集成是如何工作的,文档涵盖了这么多不同的安排,我发现这相当困难。贝宝说我应该在这个论坛上发帖

 string authToken = WebConfigurationManager.AppSettings["PDTToken"];
        //read in txn token from querystring
        string txToken = Request.QueryString.Get("tx");

        string query = string.Format("cmd=_notify-synch&tx={0}&at={1}",
                              txToken, authToken);
        // Create the request back
        string url = WebConfigurationManager.AppSettings["PayPalSubmitUrl"];
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
        // Set values for the request back
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        req.ContentLength = query.Length;
        // Write the request back IPN strings
        StreamWriter stOut = new StreamWriter(req.GetRequestStream(),
                                 System.Text.Encoding.ASCII);
        stOut.Write(query);
        stOut.Close();
        // Do the request to PayPal and get the response
        StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
        string strResponse = stIn.ReadToEnd();
        stIn.Close();
        if (strResponse.StartsWith("SUCCESS"))
        {
            PDTHolder pdt = PDTHolder.Parse(strResponse);
            return pdt;
        }
        else
        {
            return null;
        }
我的Web.Config是完全正确的,在调试过程中,url看起来是正确的,但它只是响应“FAIL”,没有更多细节


有人有什么想法吗?所需的系统将是用户添加到购物车,然后单击“订单”,然后系统将用户带到paypal.com,并在收到付款后返回我的网站

使用贝宝的.net SDK:


自述文件包含大量教程和示例代码的链接,可在c#中使用。

为了更新读者,paypal实际上有一个支持服务(我以前不知道),他们显然提供帮助。我现在用这个。