PayPal IPN via ColdFusion

After a few hours of trying to get the PayPal IPN verification process to work I was at my wits end. According to their code samples all that is required is to loop over the form.fieldNames variable. Sounds simple enough. But after hours of trying to get it to work, different combinations of lCase, urlEncodedFormat, etc. I know that coldfusion organizes the FORM structure in an alpha order by key, but the fieldnames should stay in their original order.

I finally thought to look at the GETHTTPREQUESTDATA().content, the variable order didn’t match what was in the form.fieldNames list.

First try after changing the verification string it worked like a champ, hopefully this post can save someone some grief.

<cfset postData = GETHTTPREQUESTDATA()>
<cfset verifyURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate&#postData.content#">