Drop in replacement for CFX_PAYFLOWPRO on ColdFusion 8
Last week I was all set to move several sites to new CF8 VPS and in testing I found that the CFX_PAYFLOWPRO and CF8 were not happy together. After a bit of research, it seems that some developers out there were able to get it to work, but I could not, most likely due to I had an older CFX_PAYFLOWPRO tag and the newest one is not available via Payflopro's website. In any case, spending time trying to get the CFX_PAYFLOWPRO to work with CF8 was not going to be a good idea. The system for charging cards that the custom tag uses is set to be retired September 2009.
So I went to work researching how to quickly replace the CFX_PAYFLOWPRO with the http request method.
Here is a drop in replacement for the CFX_PAYFLOWPRO custom tag, it returns the results of the transaction in a query just as the CFX_PAYFLOWPRO custom tag does.
<!--- If test account --->
<cfif ReturnText is "4111111111111111">
<cfset pfpserver='pilot-payflowpro.verisign.com' >
<cfelse>
<cfset pfpserver='payflowpro.verisign.com' >
</cfif>
<CFHTTP METHOD="POST" URL="https://#pfpserver#" TIMEOUT="180" resolveurl="no" >
<CFHTTPPARAM type="header" NAME="Content-Type" VALUE="text/namevalue">
<CFHTTPPARAM type="header" NAME="X-VPS-Timeout" VALUE="30">
<CFHTTPPARAM type="header" NAME="X-VPS-VIT-Integration-Version" VALUE="0.01">
<CFHTTPPARAM type="header" NAME="X-VPS-Request-ID" VALUE="#CreateUUID()#">
<CFHTTPPARAM type="body" value=#PARAM#>
</CFHTTP>
<cfset PNResponse = QueryNew("")>
<cfset QueryAddRow(PNResponse, 1)>
<cfloop list="#CFHTTP.Filecontent#" index="i" delimiters="&">
<cfset QueryAddColumn(PNResponse, listfirst(i,'=') , ListToArray(listlast(i,"=")))>
</cfloop>
<cfset QueryAddColumn(PNResponse, 'RESULTSTR' , ListToArray(CFHTTP.Filecontent))>
<cfset QueryAddColumn(PNResponse, 'PARMLIST' , ListToArray(PARAM))>
Drop me a comment below, if this is useful to you, or if you have a suggestion on how to improve it.
Disclaimer: As always, test this before you deploy it, if you choose to do so, I will not be responsible for any damage it causes.
