Good morning.
Patricks test code exists in this thread posted a while ago. As for what is happening and what's not working, I'll try to explain as best I can.
I have(had since I made a change this morning) one file....success.cfm which includes my IPN code.
I have created two files now: ipn.cfm and success.cfm
ipn.cfm is my URL for PayPal setup and it is my notify_url.
success.cfm is my 'return' url
Anyways, what I did was output the CFHTTP.FileContent and the FORM.Vars sent by PP and basically wrote the URL to see what VARS were being passed. Of course, not matter what I did for testing; IE: Patricks code contained in this thread and Eliteweaver, it always came back as invalid.
I finally convinced someone to test it out live for me. PayPal recorded the transaction but for some reason I was getting those CFusion errors.
Where do I stand now? Not sure! I have ipn.cfm and success.cfm and I really do not know where to go from here now.
Thanks in advance.
PS...how would I write using CFFILE again? I'm going to include the IPN code.
<!-- read post from PayPal system and add 'cmd' -->
<CFSET str="cmd=_notify-validate">
<CFLOOP INDEX="TheField" list="#Form.FieldNames#">
<CFSET str = str & "#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#">
</CFLOOP>
<CFIF IsDefined("FORM.payment_date")>
<CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
</CFIF>
<CFIF IsDefined("FORM.subscr_date")>
<CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">
</CFIF>
<!-- post back to PayPal system to validate -->
<CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD="GET" RESOLVEURL="false">
</CFHTTP>
<!-- check notification validation -->
<CFIF #CFHTTP.FileContent# is "VERIFIED">
<!-- check that payment_status=Completed -->
<cfif FORM.payment_status eq "Completed">
<!-- check that receiver_email is your email address -->
<cfif #FORM.RECEIVER_EMAIL# eq "tmergl@pacmsolutions.com">
<!-- process payment -->
<cftry>
<cfquery name="AddOrder" datasource="COTTAGE">
INSERT INTO InsertOrder(
business,
receiver_email,
item_name,
item_number,
invoice,
payment_status,
payment_date,
txn_id,
txn_type,
payment_type,
payer_id,
first_name,
last_name
)
VALUES(
'#FORM.BUSINESS#',
'#FORM.RECEIVER_EMAIL#',
'#FORM.ITEM_NAME#',
'#FORM.ITEM_NUMBER#',
'#FORM.INVOICE#',
'#FORM.PAYMENT_STATUS#',
#CreateODBCDateTime(Now())#,
'#FORM.TXN_ID#',
'#FORM.TXN_TYPE#',
'#FORM.PAYMENT_TYPE#',
'#FORM.PAYER_ID#',
'#FORM.FIRST_NAME#',
'#FORM.LAST_NAME#'
)
</cfquery>
<cfcatch>
<!--- let's log all errors --->
<cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error order info">
</cfcatch>
</cftry>
<cfset password = #Evaluate("#RandRange(1,10000)# * #RandRange(1,10000)#")#>
<cfset serial_number = "#RandRange(1,10000)#-0-#Left(first_name,1)#">
<cftry>
<cfquery name="AddCustomer" datasource="COTTAGE">
INSERT INTO InsertCustomer(
first_name,
last_name,
email,
address,
city,
state,
zip,
payer_id,
password
)
VALUES(
'#FORM.first_name#',
'#FORM.last_name#',
'#FORM.payer_email#',
'#FORM.address_street#',
'#FORM.address_city#',
'#FORM.address_state#',
'#FORM.address_zip#',
'#FORM.payer_id#',
'#password#'
)
</cfquery>
<cfcatch>
<!--- log any errors when inserting this customer --->
<cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error inserting customer">
</cfcatch>
</cftry>
<!--- send user an email --->
<cftry>
<cfmail from="terry.mergl@coastcottages.com"
to="#FORM.payer_email#"
bcc="tmergl@pacmsolutions.com"
server="smtp.coastcottages.com"
subject="CoastCottages.com Registration">
Thank you for subscribing #item_name# with CoastCottages.com
You may login and add your listing(s) at the following URL:
http://www.coastcottages.com/
Your username is: #payer_email#
Your password is: #password#
If you have questions or need help, please go to:
http://www.coastcottages.com/support/
Thanks again for your subscription!
CoastCottages.com
PACM Solutions LLC
http://www.coastcottages.com </cfmail>
<!--- Now send yourself an email alerting that there was a sale done --->
<cfmail server="smtp.coastcottages.com" from="registered@coastcottages.com" to="tmergl@pacmsolutions.com" subject="There was a new REGISTRATION on CoastCottages.com!">
An order was placed by: #FORM.first_name#' #FORM.last_name#
Item Purchased:
Item Name: #FORM.ITEM_NAME#
Item Number: #FORM.ITEM_NUMBER#
Purchase Price: #DOLLARFORMAT(FORM.PAYMENT_GROSS)#
PayPal Fee: #DollarFORMAT(FORM.PAYMENT_FEE)#
==========================
Profit Fee: #DollarFormat(Evaluate("#FORM.PAYMENT_GROSS# - #FORM.PAYMENT_FEE#"))#
A Reminder Email:
http://www.coastcottages.com </cfmail>
<cfcatch>
<!--- Log Any Errors Sending Emails --->
<cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error sending email">
</cfcatch>
</cftry>
</cfif>
</cfif>
<CFELSEIF #CFHTTP.FileContent# is "INVALID">
<!-- log for investigation -->
<cftry>
<cfcatch>
<!--- let's log all errors --->
<cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error order info">
</cfcatch>
</cftry>
<CFELSE>
<!-- error -->
<cftry>
<cfcatch>
<!--- let's log all errors --->
<cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error order info">
</cfcatch>
</cftry>
</CFIF>
<html>
<head>
<title>CoastCottages.com - Membership Transaction In Process</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/cottages.css" type="text/css">
</head>
<body bgcolor="#8D8950" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<cfoutput>#CFHTTP.FileContent#</cfoutput>
</body>
</html>
I suck at CFusion!