Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

Classic ASP & PayPal's ASP

Hello,

I'm wondering if someone can help me put together a little code.  I'm a Classic ASP Programmer, and I need some help to fill in the blanks (...) of the following code:

Any help would be greatly appreciated.
If ... Then 'Payment has been received successfully and is in my PP
	Session("Payer_Name") = ... 'First & Last Name
	Session("Payer_EMail") = ...
	Session("Sellers_TransID") = ... 'the same number as within the confirmation e-mail at the top-right corner
Else
	Response.Redirect("test.asp")
End If
Response.Write(Session("Payer_Name") & "<br>")
Response.Write(Session("Payer_EMail") & "<br>")
Response.Write(Session("Sellers_TransID") & "<br>")

Open in new window

Avatar of Alpha Au
Alpha Au
Flag of Hong Kong image

where does the data come from? a textbox? or else?

if they are from textbox, you can use request.from("textboxname")
sorry for the typo, it should be
request.form("textboxname")
ASKER CERTIFIED SOLUTION
Avatar of Sven
Sven
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of APD Toronto

ASKER

I have looked over PP's site 10 times, but I feel tha there is either a problem with  GoDaddy's Windows Shared Hosting (IIS7),  or with the first couple of lines of my code:
I've read http://developer.paypal-portal.com/pdn/board/message?board.id=ipn&message.id=12284&query.id=556338#M12284 , and my code is below, but I still get a "INVALID"  Can anyone help?

<%@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"
 
' 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")
 
' Check notification validation
if (objHttp.status <> 200 ) then
' HTTP error handling
elseif (objHttp.responseText = "VERIFIED") then
	Response.Write("VERIFIED")
' 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
Response.Write("INVALID")
' log for manual investigation
else
Response.Write("ERROR")
' error
end if
set objHttp = nothing
%>

Open in new window