【问题标题】:how to handle paypal e-cheques如何处理paypal电子支票
【发布时间】:2015-10-17 08:23:02
【问题描述】:

我无法在我们的申请付款成功页面上处理通过 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);
        }

即使您可以从贝宝提供 NVP 回复,也会有很大帮助。

【问题讨论】:

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


    【解决方案1】:

    您有几种不同的选择。

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

    您可以设置即时付款通知并创建一个侦听器,该侦听器将从 PayPal 获取交易详细信息。详细信息可以包括电子支票的 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

    【讨论】:

      猜你喜欢
      • 2014-04-16
      • 2012-07-16
      • 1970-01-01
      • 2014-08-14
      • 1970-01-01
      • 2017-07-13
      • 2014-08-15
      • 2012-03-16
      • 1970-01-01
      相关资源
      最近更新 更多