这是我用于https://ASPSecurityKit.net的内容
    private void ProcessPayment(bool test)
    {
        try
        {
           string callbackResponse = null;
            string content = null;
            string callbackUrl = test ? "https://www.sandbox.paypal.com/cgi-bin/webscr"
            : "https://www.paypal.com/cgi-bin/webscr";
            var req = (HttpWebRequest) WebRequest.Create(callbackUrl);
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            content = Encoding.ASCII.GetString(
                Request.BinaryRead(HttpContext.Request.ContentLength)
                );
            content += "&cmd=_notify-validate";
            req.ContentLength = content.Length;
                                                using (var streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII))
            {
                streamOut.Write(content);
            }
            using (var streamIn = new StreamReader(req.GetResponse().GetResponseStream()))
            {
            callbackResponse = streamIn.ReadToEnd();
            }
            if (callbackResponse.Equals("VERIFIED", StringComparison.OrdinalIgnoreCase))
            {
                // Now validate whether gross_amount is ok, receiver_email is your business acount mail id and so on.
            }
        }
        catch (Exception ex)
        {
            // Logger.Log(ex); // Uncomment this line if you have a logger
        }
    }
注意:我将所有交易都存储在数据库中,无论是可变的还是无效的。该逻辑是ASPSecurityKit.net特定的,因此我在这里省略了。