日期:2014-05-17 浏览次数:21227 次
Dim Item_name, Item_number, Payment_status, Payment_amount Dim Txn_id, Receiver_email, Payer_email Dim objHttp, str Dim OrderCode '这里因为我们之前的程序员卷铺盖走人,我没办法才用querystring获取自定义订单号获取订单的ID OrderCode=Trim(Request.QueryString("oc")) '从PayPal 出读取POST 信息同时添加变量 "cmd? str = Request.Form & "&cmd=_notify-validate" '建议在此将接受到的信息记录到日志文件中以确认是否收到IPN 信息 '将信息POST 回给PayPal 进行验证 set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 'set obj Http = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0") 'set obj Http = Server.CreateObject("Microsoft.XMLHTTP") objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded" objHttp.Send str 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") '检查通知是否合法 if (objHttp.status <> 200 ) then '写入日志,http错误 elseif (objHttp.responseText = "VERIFIED") then '一通验证之后执行rs.open sql,conn,1,3之类的写入数据库操作 elseif (objHttp.responseText = "INVALID") then '这个是服务器跟paypal核对的信息不一致的错误,paypal说是一般这是因为编码错误或者非法post变量导致。 '这个也写入日志 else 'paypal的官方文档说这是其他错误,我在错误日志里面没发现这个类型的错误 end if set objHttp=Nothing