c# - 如何处理paypal电子支票

标签 c# paypal paypal-ipn payment-gateway paypal-sandbox

我无法在我们的申请付款成功页面上处理通过 PayPal 电子支票进行的付款。

我如何处理 PayPal 电子支票回复?我们使用下面的代码来处理响应。

try
    {
            LOgfile lg = new LOgfile();
            string strLive = System.Configuration.ConfigurationManager.AppSettings["PaypalreturnURL"].ToString();
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strLive);

            //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;


            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();
            NameValueCollection vale = HttpUtility.ParseQueryString(strRequest);


            if (strResponse == "VERIFIED")
            {
                trnsid = vale["txn_id"].ToString();
                string valecust = vale["custom"].ToString();
                string[] arycust = valecust.Split(',');

                if (!IsPostBack)
                {
                    if (arycust.Length > 0)
                    {
                       //Do something
                    }
                }
            }
        }
        catch (Exception exd)
        {
            senderrormail(exd);
        }

即使您能从 paypal 给 NVP 回复,也会有很大的帮助。

最佳答案

您有几种不同的选择。

您可以阻止电子支票付款:
How to block payments in PayPal

您可以设置即时付款通知并创建一个将从 PayPal 获取交易详细信息的监听器。详细信息可以包括 eCheck 的 payment_type。您还可以收到来自 PayPal 的交易状态更改通知。状态更改通知会告诉您电子支票何时结清且资金何时进入您的 PayPal 账户。

Setting up Instant Payment Notifications
IPN setup within PayPal
How to create a Listener
Payment Notification Variables
IPN Simulator
Event Notifications with Express Checkout

关于c# - 如何处理paypal电子支票,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31648191/

相关文章:

c# - 添加数据后如何滚动到 ListView 的末尾 - WPF

php - Paypal 立即购买按钮无需运送任何东西?

C# 私有(private)成员可见性

c# - 如何获取用户在 RichTextBox 中编写的文本的 TextRange

c# - Func<string> DoSomething : Type [. ..] Controller+<>c__DisplayClass0_0 未标记为可序列化

javascript - 使用单页应用程序(Angular)在上下文结帐中使用 PayPal

php - Paypal 自适应支付(链式)- 链式支付中不允许单边接收方

c# - Paypal 付款处理

php - PayPal 付款完成后更新数据库

php - PayPal IPN,很多注册,一次付款,都按错误的顺序