I am setting up a simple subcription process using Paypals IPN to update my database. For some reason IPN does not appear to be posting any feilds to my action page. I just get an error saying that the variable form.fieldnames cannot be resolved
The form is as follows:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="bn" value="webassist.dreamweaver.4_0_2">
<input type="hidden" name="business"
value="neil@galleries-online.co.uk">
<input type="hidden" name="item_name" value="Bronze">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="a3" value="1">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="return"
value="http://www.galleries-online.co.uk/cms/a_subscribeupdate.cfm">
<cfoutput><input type="hidden" name="cancel_return"
value="http://www.galleries-online.co.uk/cms/artist_cms.cfm?artistid=#session.artistid#content=subscribecancel"></cfoutput>
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="receiver_email"
value="neil@galleries-online.co.uk">
<input type="hidden" name="mrb" value="R-3WH47588B4505740X">
<input type="hidden" name="pal" value="ANNSXSLJLYR2A">
<input type="hidden" name="payer_id" value="#session.artistid#">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="image" name="submit"
src="http://images.paypal.com/images/x-click-butcc.gif" border="0" alt="Make
payments with PayPal, it's fast, free, and secure!">
</form>
And the script used to recieve validation is as follows:
<!-- 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 "neil@galleries-online.co.uk">
<!-- process payment -->
<cftry>
<cfquery name="qInsertOrder" datasource="#ds#">
INSERT INTO tbl_artists(
package
)
VALUES(
'#FORM.ITEM_NUMBER#'
)
WHERE artistid=#form.payer_id#
</cfquery>
<cfcatch>
<!--- log all errors --->
<cffile action="append"
file="D:\WWWRoot\galleries-onlineco.uk\www\paypal_logs\paypal_log.txt"
output="Error order info">
</cfcatch>
</cftry>
<cfelse><p>email not
neil@galleries-online.co.uk</p>
</cfif>
<cfelse><p>Payment not complete</p>
</cfif>
<cfelse><p>Not verified</p>
</cfif>
I have a feeling I am missing something really obvious here!
Cheers
Neil