Viccan
Starting Member
7 Posts |
Posted - 07 March 2005 : 19:59:45
|
I've integratd my website into Snitz forums, i.e. I use Snitz login for the whole website. Now I want to charge new members for subscriotions, and understand the most practic way is to use Paypal. I can't get the IPN in paypal to work though. I use the IPN sample code at Paypals webpage that looks like:
<%@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"
Response.Write("<br>") Response.Write("str:" & str) Response.Write("<br>")
' post back to PayPal system to validate set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0") ' set objHttp = 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
' 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")
Response.Write("<br>") Response.Write("objHttp.responseText:" & objHttp.responseText) Response.Write("<br>")
' 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 %>
I know I have to modify the code after: elseif (objHttp.responseText = "VERIFIED") then. But I don't know how. I want the users that have paid to me be able to enter the protected area, while the ones that haven't be redirected to activate.asp. Can someone help me please? |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 09 March 2005 : 00:51:27
|
Look at the paypal pages more in depth. I've dealt with this before and paypal has some good references.
The IPN is unique to you and generated only when you activate it, and should only work with certain pages on your website, not all of them. I'm pretty sure you have to put a URL in there that it is to be used from. |
-Stim |
 |
|