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.

Download Code

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>

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#">

Related Blog Entries

Comments
Duncan Loxton's Gravatar Thanks for all this work, I installed it today and its great!

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>
# Posted By Duncan Loxton | 10/18/07 2:19 AM
David's Gravatar We have been using payflowpro for years now and needed a solution for cf 8. I have been trying to find the PFProAPI file/class/jar file but I have no idea where to look. Looked through the sdk's on paypal developer website, but could not find this file. First is it a class or jar? Where can I download this file?
# Posted By David | 11/1/07 1:51 PM
Dave Cordes's Gravatar David,
After further testing with ColdFusion 8, the VeriSign download works fine. I would recommend implementing that solution instead of the one posted.
# Posted By Dave Cordes | 11/1/07 2:29 PM
David's Gravatar I tried the cfx custom tag, but got a error. I will try again.
# Posted By David | 11/1/07 2:37 PM
Will's Gravatar Hi,
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
# Posted By Will | 11/2/07 7:14 AM
Will's Gravatar set the class path in CF8's CFadmin at:
Server Settings > Java and JVM
ColdFusion Class Path

VV
# Posted By Will | 11/2/07 7:21 AM
Dave Cordes's Gravatar Will,
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.
# Posted By Dave Cordes | 11/2/07 8:46 AM
David's Gravatar do you know if paypal has a new or a place where I can download the cfx custom tag? I looked all over the place and can't find anything about that custom tag.
Also from what I have read on their forums they will end support for that method in 2009.
# Posted By David | 11/2/07 10:50 AM
Dave Cordes's Gravatar David,
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.
# Posted By Dave Cordes | 11/2/07 1:47 PM
Dave Cordes's Gravatar Ok, I take that back. It's not there anymore. Send me your email address and I will email it back to you.
# Posted By Dave Cordes | 11/2/07 1:52 PM
Keith's Gravatar I read what Dave said about the old custom tag working with ColdFusion 8. I'm not so lucky. I call the test page that comes with the Java/CF SDK and I get the result:
-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?
# Posted By Keith | 11/21/07 2:35 AM
Dave Cordes's Gravatar Good question. I was getting the same thing forever. I know this sounds crazy, but I would uninstall ColdFusion and reinstall it from a fresh download. That seemed to work for me on my development server.
# Posted By Dave Cordes | 11/21/07 8:41 AM
Robert Owen's Gravatar I've logged into my payflow manager and cannot find the custom tag.. I contacted support and they say they no longer have a coldfusion tag and do not have the old versions. Does anyone know where else I could find this? I moved a webstore to another server and cannot turn it back on until I find it.

Thanks in advance.
# Posted By Robert Owen | 12/4/07 6:21 PM
newsworldjournal's Gravatar thanks for posting
interesting site
http://newsworldjournal.com
# Posted By newsworldjournal | 4/11/08 8:19 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.