Paypal链式支付IPN不会停止回调

时间:2015-02-26 23:09:17

标签: paypal paypal-ipn payment chained

我在尝试让Paypal停止IPN回调时遇到严重问题。在我验证事务并使用我的IPN侦听器处理它之后,我将消息直接通过HTTP Post发送回Paypal。我记录返回消息,该消息总是以VERIFIED的形式返回。

这是我发回Paypal的内容,每个val用|分隔为了便于阅读

Form Vals: transaction[0].is_primary_receiver:true | transaction[0].id_for_sender_txn:4YY80224KU744182S | log_default_shipping_address_in_transaction:false | transaction[0].receiver:za@gmail.com | action_type:PAY | ipn_notification_url:http://www.example.com/Paypal/IPNListener | transaction[1].paymentType:SERVICE | transaction[0].amount:USD 1.55 | charset:windows-1252 | transaction_type:Adaptive Payment PAY | transaction[1].id_for_sender_txn:0FS22745TN9966034 | transaction[1].is_primary_receiver:false | transaction[0].status:Completed | notify_version:UNVERSIONED | transaction[0].id:5B218293JN593094R | cancel_url:http://www.example.com/Paypal/PaymentCanceledConfirmation | transaction[1].status_for_sender_txn:Completed | transaction[1].receiver:admin@example.com | verify_sign:AiPC9BjkCyDFQXbSkoZcgqH3hpacAEFoy0ipZhsKn7zJVWqtp2H1UZjq | sender_email:example@hotmail.com | fees_payer:EACHRECEIVER | transaction[0].status_for_sender_txn:Completed | return_url:http://www.example.com/Paypal/PaymentConfirmation | transaction[0].paymentType:SERVICE | transaction[1].amount:USD 0.07 | reverse_all_parallel_payments_on_error:false | tracking_id:10 | transaction[1].pending_reason:NONE | pay_key:AP-7DV229946G566022G | transaction[1].id:490095471X083615J | transaction[0].pending_reason:NONE | status:COMPLETED | transaction[1].status:Completed | payment_request_date:Thu Feb 26 15:01:35 PST 2015 |

这是我用来将REQUEST发回Paypal的代码:

private string GetPayPalResponse(Dictionary<string, string> formVals)
    {
        string url = ConfigurationManager.AppSettings["PaypalUrl"];

        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

        // Set values for the request back
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";

        byte[] param = Request.BinaryRead(Request.ContentLength);
        string strRequest = Encoding.ASCII.GetString(param);

        StringBuilder sb = new StringBuilder();
        sb.Append(strRequest);

        foreach (string key in formVals.Keys)
        {
            sb.AppendFormat("&{0}={1}", key, formVals[key]);
        }
        strRequest += sb.ToString();
        req.ContentLength = strRequest.Length;

        //Send the request to PayPal and get the response
        string response = "";
        using (StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII))
        {
            streamOut.Write(strRequest);
            streamOut.Close();
            using (StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream()))
            {
                response = streamIn.ReadToEnd();
            }
        }

        return response;
    }

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

您的IPN脚本必须存在某种错误,以防止它将200 OK响应返回给PayPal。您需要运行一些测试才能找到问题,或者您可以查看网络日志以查看问题。

这是一篇关于您可能感兴趣的how to test PayPal IPN的文章。按照这些步骤,您应该能够确定问题所在。