贝宝IPN状态始终是无效的? [英] Paypal IPN status is always invalid?

查看:400
本文介绍了贝宝IPN状态始终是无效的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我越来越从IPN无效响应,如返回URL和通知URL提到的一些人不应该是相同的,但我以这种方式还甚至我得到同样的结果改变。
这里是我的code缴交款项,支付工作正常。

Am getting Invalid response from IPN, some people mentioned like return url and notification url shouldn't be same but i changed in that way also even am getting same result. Here is my code for making payment,payment is working fine.

 Paypal paypal = new Paypal();
            paypal.cmd = "_xclick";
            paypal.business = ConfigurationManager.AppSettings["BusinessAccountKey"];
            bool useSandbox = Convert.ToBoolean(ConfigurationManager.AppSettings["UseSandbox"]);
            paypal.cancel_return = "http://www.patronalerts.com/";
            //paypal.@return = ConfigurationManager.AppSettings["ReturnURL"];
            paypal.@return = "http://www.patronalerts.com/";
            paypal.notify_url = ConfigurationManager.AppSettings["NotifyURL"];
            paypal.currency_code = ConfigurationManager.AppSettings["CurrencyCode"];
            paypal.item_name = "Test Product";
            paypal.amount = "10";

            url = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd="+paypal.cmd +"&business="+ paypal.business+"&no_shipping=&return="+paypal.@return+"&cancel_return="+paypal.cancel_return+"&currency_code="+paypal.currency_code+"&item_name="+ paypal.item_name+"&amount="+ paypal.amount;

但随着PayPal账户低于code或配置问题我无法猜测。最有可能与贝宝的配置,因为每个人都使用这个code。

But the problem with below code or configuration in paypal account i can't guess. most probably with paypal configuration because every one using this code.

string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        byte[] param = Request.BinaryRead(System.Web.HttpContext.Current.Request.ContentLength);
        string strRequest = Encoding.ASCII.GetString(param);
        string strResponse_copy = strRequest;  //Save a copy of the initial info sent by PayPal
        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();

        if (strResponse == "VERIFIED")
        {
            NameValueCollection these_argies = HttpUtility.ParseQueryString(strResponse_copy);
            string user_email = these_argies["payer_email"];
            string pay_stat = these_argies["payment_status"];

            if (pay_stat.Equals("Completed"))
            {
                ViewBag.Result = "Kishore Suceess";
            }              
        }
        else if (strResponse == "INVALID")
        {
            ViewBag.Result = "invalids";
        }
        else
        {
            ViewBag.Result = "Ipn data for manual investigation";             
        }

如果任何机构帮助我将appriciated。

If any body help me out would be appriciated.

推荐答案

无效消息是由于以下原因:结果
- 检查你的张贴到正确的网址,这是的 https://www.sandbox.paypal.com/cgi-bin/webscr https://www.paypal.com/cgi-bin/webscr,这取决于你在沙盒测试,或者你分别住。结果
- 验证您的测试IPN消息响应的包含完全相同的变量和值作为测试的消息,他们都以相同的顺序作为测试邮件即可。最后,请确认原始变量是一个cmd = _notify-验证变量pceded $ P $。结果
- 确保您的编码您的响应字符串并使用相同的字符编码​​使用的考验IPN消息。 (例如,我可以看到他是用字母加变音符号和其他符号如/等)。

An "INVALID" message is due to the following reasons:
- Check that your are posting your response to the correct URL, which is https://www.sandbox.paypal.com/cgi-bin/webscr or https://www.paypal.com/cgi-bin/webscr, depending on whether you are testing in the Sandbox or you are live, respectively.
- Verify that your response to the test IPN message contains exactly the same variables and values as the test message and that they are in the same order as in the test message. Finally, verify that the original variables are preceded by a cmd=_notify-validate variable.
- Ensure that you are encoding your response string and are using the same character encoding as used by the test IPN message. (for example, I can see that he is using letters with umlaut and other symbols like "/", etc).

,商家可以试着改变所使用的编码语言在他的支付宝账户,按照以下步骤:

With regard to the last point, the merchant can try to change the encoding language in use in his PayPal account, following the steps below:


  1. 登录您的PayPal账户

  2. 单击上配置文件

  3. 单击选项卡上的我的销售preferences

  4. 点击PayPal按钮语言编码(在页面的结尾)

  5. 单击其他选项

  6. 从下拉菜单中选择:UTF-8

  7. 选择相同的字符集也为第二个选项,这是关系到IPN

  8. 单击保存

如果问题仍然存在,我们建议审查使用脚本,贝宝有可用的一些IPN code样品在:的 https://github.com/paypal/ipn-$c$c-samples

If the issue persists, we recommend to review the script in use, PayPal has some IPN code samples available at: https://github.com/paypal/ipn-code-samples

有关更多的信息我包括链接:<一个href=\"https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNTesting/#id091GFE00WY4\" rel=\"nofollow\">https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNTesting/#id091GFE00WY4

For additional information I include the link: https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNTesting/#id091GFE00WY4

这篇关于贝宝IPN状态始终是无效的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆