Jump to content


Photo

Need help debugging


  • This topic is locked This topic is locked
2 replies to this topic

#1 Guest(old)

Guest(old)

    Junior Member

  • Members
  • 312 posts

Posted 03 December 2002 - 03:30 PM

Hi!

Here's the code I'm trying to use for the IPN. I'm not getting any response from paypal's server. What am I doing wrong? Help!!!

<%@LANGUAGE="VBScript"%>
<!-- #include virtual = "config/classlib.asp" -->
<%
Dim str, OrderID, Txn_id, Payment_status, NewTrans
Dim objHttp

' read post from PayPal system and add 'cmd'
str = Request.Form
OrderID = Request.Form("item_number")
Txn_id = Request.Form("txn_id")
Payment_status = Request.Form("payment_status")

' post back to PayPal system to validate
str = str & "&cmd=_notify-validate"
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
objHttp.Send str

' assign posted variables to local variables
' note: additional IPN variables also available -- see IPN documentation
Item_name = Request.Form("item_name")
Receiver_email = Request.Form("receiver_email")
Item_number = Request.Form("item_number")
Invoice = Request.Form("invoice")
Payment_status = Request.Form("payment_status")
Payment_gross = Request.Form("payment_gross")
Txn_id = Request.Form("txn_id")
Payer_email = Request.Form("payer_email")
Payer_status = Request.Form("payer_status")
Payment_type = Request.Form("payment_type")
Payment_fee = Request.Form("payment_fee")
Payment_date = Request.Form("payment_date")


' 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

sql = "SELECT * FROM Payments WHERE [CHECK #] = '" & Txn_id & "'"
set rs = createObject("ADODB.Recordset")
rs.open sql, conn, 3, 3

if not rs.eof then
newtrans = "N"
else:
newtrans = "Y"
end if
rs.close
set rs = nothing

' check that Receiver_email is an email address in your PayPal account
' process payment
If newtrans = "Y" then

sql = "SELECT * FROM Payments"
set Pmts = createObject("ADODB.Recordset")
Pmts.open sql, conn, 3, 3

RecordFound = "N"

If Invoice <>"" Then


sqlinv = "SELECT * FROM Invoice WHERE [ID] = " & Invoice & ""
set InvTbl = createObject("ADODB.Recordset")
InvTbl.open sqlinv, conn, 3, 3


If Not InvTbl.EOF Then
Pmts.addnew
Pmts("Quote#") = Invoice
Pmts("Payment") = Payment_gross
Pmts("TransactionFee") = Payment_fee
Pmts("Client") = InvTbl("Client")
Pmts("Action") = 1
Pmts("ACODE") = "3994"
Pmts("Approved") = -1
Pmts("CustID") = InvTbl("CustID")
Pmts("Paid By") = "PayPal"
Pmts("check #") = Txn_id
Pmts("Payment Date") = Payment_date
'Pmts("PayerStatus") = Payer_status
Pmts("PaymentType") = Payment_type
Pmts.Update
End If


TotalPaid = InvTbl("TotalPaid")


InvTbl("TotalPaid") = TotalPaid + Payment_gross
InvTbl.Update
InvTbl.Close
set InvTbl = Nothing
Pmts.close
set Pmts = Nothing

RecordFound = "Y"

end if

end if

elseif (objHttp.responseText = "INVALID") then
' log for manual investigation
else
' error
end if
set objHttp = nothing
%>


#2 DaveC

DaveC

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 04 December 2002 - 06:54 AM

What is (not) happening?

Have you enabled IPN in your PAYPAL account?

Are you getting an error on your page?

Try calling your page direct yourself, see if there are any syntax errors, then you can try the eliteweaver page (sorry, don't know URL, but it is mentioned somewhere on this board)

DaveC

Web development - http://www.revilloc.com

#3 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 04 December 2002 - 11:38 AM

Try POSTing this FORM to your script (set the "action" to point to your script):

<form method="post" action="http://www.mysite.com/ipn.cfm">
<input type="submit" name="" value="Test IPN">
<input type="hidden" name="payment_date" value="17:53:45 Nov 5, 2002 PST">
<input type="hidden" name="txn_type" value="web_accept">
<input type="hidden" name="last_name" value="Breitenbach">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="payment_gross" value="0.01">
<input type="hidden" name="mc_currency" value="USD">
<input type="hidden" name="payment_type" value="instant">
<input type="hidden" name="verify_sign" value="AlWncXKLadIepzMosHhM.VWxC0Z6AZYI0ynXRnEUma0d3RMC.TXWaJro">
<input type="hidden" name="payer_status" value="unverified">
<input type="hidden" name="payer_email" value="pb-test@paypal.com">
<input type="hidden" name="txn_id" value="01G32341KC3727119">
<input type="hidden" name="first_name" value="Patrick">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="receiver_email" value="pb-sell@paypal.com">
<input type="hidden" name="payer_id" value="QGVDAFGZ9XHLJ">
<input type="hidden" name="payment_method" value="non_cc">
<input type="hidden" name="item_number" value="">
<input type="hidden" name="payment_status" value="Completed">
<input type="hidden" name="mc_gross" value="0.01">
<input type="hidden" name="custom" value="">
<input type="hidden" name="notify_version" value="1.4">
</form>

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users