Paypal链式支付IPN不会停止回调
Paypal Chained Payment IPN Won't Stop Callbacks
我在尝试让 Paypal 停止 IPN 回调时遇到严重问题。在我验证交易并使用我的 IPN 侦听器在我这边进行处理后,我直接通过 HTTP Post 将消息发送回 Paypal。我记录了 return 消息,它总是以已验证的形式返回。
这是我post回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 |
这是我用来 post 请求返回 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;
}
非常感谢任何帮助!
您的 IPN 脚本中一定有某种错误,导致它无法向 PayPal 返回 200 OK 响应。您需要 运行 进行一些测试才能发现问题,或者您也可以只检查您的网络日志以查看问题。
这是一篇关于 how to test PayPal IPN 的文章,您可能会感兴趣。按照这些步骤,您应该能够查明问题所在。
我在尝试让 Paypal 停止 IPN 回调时遇到严重问题。在我验证交易并使用我的 IPN 侦听器在我这边进行处理后,我直接通过 HTTP Post 将消息发送回 Paypal。我记录了 return 消息,它总是以已验证的形式返回。
这是我post回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 |
这是我用来 post 请求返回 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;
}
非常感谢任何帮助!
您的 IPN 脚本中一定有某种错误,导致它无法向 PayPal 返回 200 OK 响应。您需要 运行 进行一些测试才能发现问题,或者您也可以只检查您的网络日志以查看问题。
这是一篇关于 how to test PayPal IPN 的文章,您可能会感兴趣。按照这些步骤,您应该能够查明问题所在。