New PayflowPro ColdFusion Component
Well it's been a long road trying to figure out why I could never get CFX_PayflowPro to work on ColdFusion 8. Nevertheless with Dan Vega and Mark Mandel's support I now have a full featured component that can do the following.
- Authorizations
- Delayed Captures
- Sales
- Voids
- Credits
- Voice Authorizations
- Inquiries
I won't post the entire tag in code view but I will make it available as part of Dan Vega's RIAForge project very soon. In the meantime, here is a zip file containing both my verisign.cfc and Dan's project together.
Note: In order for this component to work out of the box you must copy the entire payflowpro directory right under the verisign.cfc component which is the way it unzips. Also, place the following code snippet in your application.cfc.
<cfif NOT IsDefined("server.init") OR StructKeyExists(url,"reinit")>
<!--- Load paths --->
<cfset loadPaths = arrayNew(1)>
<cfset loadPaths[1] = "\path\to\payflowpro\lib\Verisign.jar">
<!--- Create loader --->
<cfset loader = createObject("component","path.to.payflowpro.com.compoundtheory.javaloader.JavaLoader").init(loadPaths)>
<!--- Create class instance --->
<cfset server.pfpro = loader.create("path.to.payflowpro.com.Verisign.payment.PFProAPI")>
<!--- Set server variable --->
<cfset server.init = true>
</cfif>
<!--- Load paths --->
<cfset loadPaths = arrayNew(1)>
<cfset loadPaths[1] = "\path\to\payflowpro\lib\Verisign.jar">
<!--- Create loader --->
<cfset loader = createObject("component","path.to.payflowpro.com.compoundtheory.javaloader.JavaLoader").init(loadPaths)>
<!--- Create class instance --->
<cfset server.pfpro = loader.create("path.to.payflowpro.com.Verisign.payment.PFProAPI")>
<!--- Set server variable --->
<cfset server.init = true>
</cfif>
Here is a sample transaction that processes a sale.
<cfinvoke component="path.to.verisign" method="processSale" returnvariable="PayFlowProResult">
<cfinvokeargument name="HOST_ADDRESS" value="test-payflow.verisign.com">
<cfinvokeargument name="HOST_PORT" value="443">
<cfinvokeargument name="TIMEOUT" value="30">
<cfinvokeargument name="USER" value="username">
<cfinvokeargument name="PWD" value="password">
<cfinvokeargument name="PARTNER" value="partner">
<cfinvokeargument name="VENDOR" value="vendor">
<cfinvokeargument name="TRXTYPE" value="S">
<cfinvokeargument name="TENDER" value="C">
<cfinvokeargument name="ACCT" value="4111111111111111">
<cfinvokeargument name="EXPDATE" value="1207">
<cfinvokeargument name="AMT" value="1.00">
<cfinvokeargument name="INVNUM" value="123456">
<cfinvokeargument name="CUSTCODE" value="123456">
<cfinvokeargument name="LOCALTAXAMT" value="0.00">
</cfinvoke>
<cfdump var="#PayFlowProResult#">
<cfinvokeargument name="HOST_ADDRESS" value="test-payflow.verisign.com">
<cfinvokeargument name="HOST_PORT" value="443">
<cfinvokeargument name="TIMEOUT" value="30">
<cfinvokeargument name="USER" value="username">
<cfinvokeargument name="PWD" value="password">
<cfinvokeargument name="PARTNER" value="partner">
<cfinvokeargument name="VENDOR" value="vendor">
<cfinvokeargument name="TRXTYPE" value="S">
<cfinvokeargument name="TENDER" value="C">
<cfinvokeargument name="ACCT" value="4111111111111111">
<cfinvokeargument name="EXPDATE" value="1207">
<cfinvokeargument name="AMT" value="1.00">
<cfinvokeargument name="INVNUM" value="123456">
<cfinvokeargument name="CUSTCODE" value="123456">
<cfinvokeargument name="LOCALTAXAMT" value="0.00">
</cfinvoke>
<cfdump var="#PayFlowProResult#">

I have made a few adjustments but the major find I came across from the zip on this page was setCurrency(), a typo in argument and it didnt actually go and set variables.currency
<!--- CURRENCY --->
<cffunction name="setCurrency" access="public" output="false" returntype="void">
<cfargument name="cur" type="string" required="true" hint="USD (US dollar)| EUR (Euro)| GBP (UK pound)| CAD (Canadian dollar) |JPY (Japanese Yen)| AUD (Australian dollar)">
<cfset var valid = "USD,EUR,GBP,CAD,JPY,AUD">
<cfif NOT listFind(valid,UCase(arguments.cur))>
<cfthrow type="PayflowPro.setCurrency" message="Invalid Currency">
</cfif>
<cfset variables.currency = arguments.cur>
</cffunction>
<cffunction name="getCurrency" access="public" output="false" returntype="string">
<cfreturn variables.currency>
</cffunction>
After further testing with ColdFusion 8, the VeriSign download works fine. I would recommend implementing that solution instead of the one posted.
I've just upgraded to CF8 and use the CFX_PAYFLOWPRO tag... i was brave/silly enough to try it and it works! (at least i think it does - what exactly is supposed to NOT work?)... anyhow all i needed to do was set the class path in CFadmin as that didn't come across in the upgrade/migration
lucky me?
VV
Server Settings > Java and JVM
ColdFusion Class Path
VV
You're exactly correct, it does work. When I was beta testing ColdFusion 8 for some reason I was having major issues which is why I had to fall back on another solution. But trust me, the one that PayPal provides is MUCH easier.
Also from what I have read on their forums they will end support for that method in 2009.
You need to login to your PayPal account at the following URL.
https://manager.paypal.com/
After that you can download the custom tag by clicking on Documentation > Payflow Pro SDKs. If you can't login let me know and I will email you the files.
-31 error, The certificate chain did not validate....
I delete the CERTPATH in my CFX_PAYFLOWPRO query to verify the cert path and working directory, which comes back with:
Cert Path = certs, Working Directory = C:\ColdFusion8\runtime\bin
So I add the Certs directory with the f73e89fd.0 file in it to C:\ColdFusion8\runtime\bin then get the "The certificate chain did not validate" business again.
Any ideas?
Thanks in advance.
interesting site
http://newsworldjournal.com