昨天上午,在PayPal更新其開發站點之前,我正在開發我的IPN偵聽器腳本,使用模擬器能夠成功發送測試IPN消息。在他們改變網站之後,模擬器現在爲相同的腳本返回http 401錯誤。我沒有改變任何東西,甚至嘗試致電貝寶支持。該技術人員表示,他們在更新網站時並不知道IPN的任何問題或更改。我的腳本是經典的asp。IPN模擬器返回401錯誤
我還嘗試使用PHP和ASP.NET中的開發站點上可用的演示腳本之一,並收到相同的401錯誤代碼。我在一個Windows平臺上與GoDaddy進行託管,但正如我所說的,在網站更改之前,一切正常。
有沒有其他人有這個問題?任何建議?以下是我在我的頁面上使用的代碼。
<%@LANGUAGE="VBScript"%>
<%
Dim Item_name, Item_number, Payment_status, Payment_amount
Dim Txn_id, Receiver_email, Payer_email
Dim objHttp, str
'read post from PayPal system and add 'cmd'
str = Request.Form & "&cmd=_notify-validate"
'post back to PayPal system to validate
'PayPal Sandbox settings
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
'set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
'set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
'PayPal Sandbox settings
objHTTP.Open "POST", "https://www.sandbox.paypal.com/cgi-bin/webscr" , false
objHTTP.setRequestHeader "Host", "www.sandbox.paypal.com"
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.Send str
'assign posted variables to local variables
Item_name = Request.Form("item_name")
Item_number = Request.Form("item_number")
Payment_status = Request.Form("payment_status")
Payment_amount = Request.Form("mc_gross")
Payment_currency = Request.Form("mc_currency")
Txn_id = Request.Form("txn_id")
Receiver_email = Request.Form("receiver_email")
Payer_email = Request.Form("payer_email")
'Check notification validation
if (objHttp.status <> 200) then
'HTTP error handling
elseif (objHttp.responseText = "VERIFIED") then
'check that Payment_status=Completed
'check that Txn_id has not been previously processed
'check that Receiver_email is your Primary PayPal email
'check that Payment_amount/Payment_currency are correct
'process payment
elseif (objHttp.responseText = "INVALID") then
'log for manual investigation
else
'error
end if
Set objHttp = nothing
%>
我只是想分享一下,問題是從PayPal的一方解決的。一旦他們糾正了有關Sandbox和IPN模擬器的問題,我的HTTP 401錯誤就消失了。希望這可以幫助其他人的問題。 – 2013-03-14 20:59:45