objHttp.responseText (PayPal qry)

Results 1 to 3 of 3

Thread: objHttp.responseText (PayPal qry)

  1. #1
    Join Date
    Dec 1969

    Default objHttp.responseText (PayPal qry)

    I am using ASP and a MySQL database for my IPN work (instant payment notification used by PayPal).<BR><BR>I am trying to use IPN on a subscriptions site.<BR><BR>I have my signup page where users fill in basic details, and when registered on my site, go on to make their payment with PayPal. These payments have been processed correctly, as I can see from some debugging that the payment_status of my transactions is &#039;Completed&#039;.<BR><BR>However, when I run through my ipn script, and do a simple SQL write to a db, the status keeps coming through as &#039;ERROR&#039; as per below, instead of &#039;VERIFIED&#039;.<BR><BR>I cannot work out why this is happening - if the payment is being processed correctly, the payment_status is &#039;Completed&#039; and the payer_status is &#039;Verified&#039;, then why should the IPN script be returning an error?<BR><BR>I checked my ISS logs, and there were errors earlier in my testing, to do with ASP stuff like missing connection strings, and SQL errors.<BR><BR>Those have been removed though, and later tests show that the page clears with a status 200 (= OK), along the lines of:<BR><BR>2004-08-30 13:26:31 - 80 POST /v/subscriptions/ipn001.asp - 200 1239 813 - - -<BR><BR>so there is actually no error. The page is clearing without a problem, but the code is still logging an error. I am completely stuck.<BR><BR>I am aware this is more of a question for the PayPal community, but I have tried there to no avail today: http://www.paypaldev.org/topic.asp?TOPIC_ID=6963<BR><BR>Thanks<BR><BR>this is the ipn script:<BR><BR>----------------------------------------------------------------<BR>[code language="VBScript"]<BR>&#060;!--#include file="../inc/c.asp" --&#062;<BR>&#060;%<BR>&#039; read post from paypal system and add &#039;cmd&#039;<BR>str = request.form<BR>orderid = request.form("item_number")<BR>txn_id = request.form("txn_id")<BR>payment_status = request.form("payment_status")<BR>custom = request.form("custom")<BR><BR>&#039; post back to paypal system to validate<BR>str = str & "&cmd=_notify-validate"<BR>set objhttp = server.createobject("msxml2.serverxmlhttp")<BR>obj http.open "post", "https://www.paypal.com/cgi-bin/webscr", false<BR>objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"<BR>objhttp.send str<BR><BR>&#039; Check notification validation<BR>if (objHttp.status &#060;&#062; 200 ) then<BR><BR>sql004 = "INSERT INTO v_subs_test (fld_outcome, fld_date) VALUES (&#039;&#060;&#062;200&#039;,now()) "<BR>set rs004 = oConn.Execute(sql004)<BR>set rs004 = nothing<BR><BR>elseif (objHttp.responseText = "VERIFIED") then<BR><BR>sql004 = "INSERT INTO v_subs_test (fld_outcome, fld_date) VALUES (&#039;VERIFIED&#039;,now()) "<BR>set rs004 = oConn.Execute(sql004)<BR>set rs004 = nothing<BR><BR>response.write sql003<BR><BR>set rs003 = oConn.Execute(sql003)<BR>set rs003 = nothing<BR><BR>elseif (objHttp.responseText = "INVALID") then<BR><BR>sql004 = "INSERT INTO v_subs_test (fld_outcome, fld_date) VALUES (&#039;INVALID&#039;,now()) "<BR>set rs004 = oConn.Execute(sql004)<BR>set rs004 = nothing<BR><BR>&#039; log for manual investigation<BR>else<BR><BR>sql004 = "INSERT INTO v_subs_test (fld_outcome, fld_date) VALUES (&#039;ERROR&#039;,now()) "<BR>set rs004 = oConn.Execute(sql004)<BR>set rs004 = nothing<BR><BR>end if<BR><BR>set objHttp = nothing<BR><BR>oConn.Close:set oConn=nothing<BR>%&#062;<BR>[/code]

  2. #2
    Join Date
    Dec 1969

    Default RE: objHttp.responseText (PayPal qry)

    Have you tried PayPal&#039;s help line? They are actually pretty responsive and will sometimes look over your actual code.<BR><BR>Sorry, I don&#039;t have the number with me.<BR><BR>Kurt

  3. #3
    Join Date
    Dec 1969

    Default Well, I *HAVE* to ask...

    ...a really dumb question.<BR><BR>When you do this:<BR><BR>if (objHttp.status &#060;&#062; 200 ) then<BR> sql004 = "INSERT INTO v_subs_test (fld_outcome, fld_date) VALUES (&#039;&#060;&#062;200&#039;,now()) "<BR> set rs004 = oConn.Execute(sql004)<BR><BR>What *IS* the objHTTP.status????????? Why don&#039;t you put *THAT* into fld_outcome???<BR><BR>***********<BR><BR>Incidenta lly, using ADODB.Connection.Execute with a SQL INSERT or DELETE or UPDATE query *does not* return a recordset.<BR><BR>So doing<BR> set rs004 = oConn.Execute(sql004)<BR> set rs004 = Nothing<BR>is redundant. Because the first line there already set rs004 to Nothing. In other words, dump the RS variable. Just do<BR> oConn.Execute sql004<BR><BR>[And it&#039;s a SUB, not a FUNCTION, when used like that so the parens are not needed.]<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts