engineroom
asked on
PayPal And IPN
hey all, here's my question... i'm trying to integrate paypal into my shopping cart. Now, when someone checks out and completes the whole paypal thing right, on success, it goes to my success page, cool. My question is, what is the IPN for? If i'm sending someone to a success page, can't i just pass some vars with the success url that lets me know they completed the paypal thing? Hope i made this clear enough. Thanx all.
The URL PayPal send to is not dynamic, so it would be the same URL variables everytime...that wouldn't do you any good would it?
ASKER
no, i think i figured it out. correct me if i'm wrong.
User clicks the button and then pays, as soon as they accept the payment, the IPN page is called on. So the IPN is before the Success page. right? If that's the case, then i can work with that. I'm just not sure of the order of execution on this thing.
User clicks the button and then pays, as soon as they accept the payment, the IPN page is called on. So the IPN is before the Success page. right? If that's the case, then i can work with that. I'm just not sure of the order of execution on this thing.
Yes you can and actually paypal suggests you include information in your return url like maybe their order id or some other unique Identifier so that you know everything was submitted correctly without having to check you paypal account. Just be careful some people look just for paypal shopping carts to try and rip them off. I have seen it many times.
ASKER
What do you mean? How do they rip them off?
There are a lot of ways, like modifying the contents of the hidden variables before it is sent to ebay, or the price of what it is. I did consulting for a few companies using paypal IPN, and the best way is on the recieving pae to check what they bought and make sure everything is set orrectly, if not flag the TX and reverse the paypal.
ASKER
ok, here's another question for you. Using IPN, it posts to my ipn.asp right. What vars is it posting? The paypal form? or the string i pass for the success page. So, when IPN posts to my asp page, am i seeing...
<input type="hidden" name="notify_url" value="http://blah.com/ipn.asp?orderNum=29030">
OR
<input type="hidden" name="orderID" value="b23808xnstH">
OR
<input type="hidden" name="return" value="http://blah.com/success.asp?orderNum=2003992">
? thanx again!
<input type="hidden" name="notify_url" value="http://blah.com/ipn.asp?orderNum=29030">
OR
<input type="hidden" name="orderID" value="b23808xnstH">
OR
<input type="hidden" name="return" value="http://blah.com/success.asp?orderNum=2003992">
? thanx again!
It posts the string that you pass to it, and some other non useful paypal information. So you would get this on your ipn.asp
var = request.querystring("order Num")
var = request.querystring("order
ASKER
yeah, but which one of the 3 examples does it use? You're saying it uses...
<input type="hidden" name="notify_url" value="http://blah.com/ipn.asp?orderNum=29030">
<input type="hidden" name="notify_url" value="http://blah.com/ipn.asp?orderNum=29030">
ASKER
?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so, question is, will payPal post to my IPN page
orderNum=2003992
?
orderNum=2003992
?
Yes
ASKER
Cool. Let me give it a shot. Thanx!
ASKER
okay, what if i do the ipn thing and it returns "Pending" ? What happens then? I can't cancel the order cause it might go through later. How do i identify that order so that my client can go into an admin control panel (or automatically) and try the ipn again to try to get a positive response?
ASKER
Okay, i got the vars posting. Thanx for that! Just one more little question. Hope any of you guys can help. It's posting to the ipn.asp page, but it's response is invalid. What's the deal with that? I looked at what pp is posting and the status comes back complete, but INVALID? any idea guys? FYI, I'm posting to the sandbox site.
What variable comes back invalid? Maybe something you didnt set on the selling side or something unneeded?
ASKER
not the var, the response from PP.
For Each Key in Request.Form
data = data & Key & "=" & Request.Form(Key) & "&"
Next
data = data & "cmd=_notify-validate"
'Create XMLHTTP Object
set xml = Server.CreateObject("MSXML 2.ServerXM LHTTP")
xml.open "POST", "https://www.sandbox.paypal.com/cgi-bin/webscr" & "?" _
& data & "", false
xml.send ""
ipnStatus = xml.Status
ipnResponse = xml.responseText
set xml = nothing
ipnResponse = "Invalid"
For Each Key in Request.Form
data = data & Key & "=" & Request.Form(Key) & "&"
Next
data = data & "cmd=_notify-validate"
'Create XMLHTTP Object
set xml = Server.CreateObject("MSXML
xml.open "POST", "https://www.sandbox.paypal.com/cgi-bin/webscr" & "?" _
& data & "", false
xml.send ""
ipnStatus = xml.Status
ipnResponse = xml.responseText
set xml = nothing
ipnResponse = "Invalid"