Payflow Pro Made Easy

Word Count: 344

If you have ever had to do credit card processing you most likely have come across this problem in the past. Payflow Pro is a popular gateway that you may have used back in the day and was previously owned by Verisign. Times have changed and now Paypal owns the software but what we are going to discuss should work for both. In the past (at least to my knowledge) you had to install the cfx_payflowpro tag on your ColdFusion server which ended up being a big pain, especially if you did not have rights to the server.

Today I am happy to announce that I have solved that problem. Credit card processing using Paypal's PayflowPro just got a lot easier. The reason for this is mainly due to Mark Mandel's Java Loader which is a library that handles creation of Java objects from external Java libraries. So how does it work? I have created a component using JavaLoader that will load the java class files and basically wraps the Java methods. This is great because now you can process credit cards without installing anything on the server.

The code is not quite ready to be released yet but I thought I would share a little code snippet. Imagine at the end of your checkout process you could provide real time processing with as little code as shown below.

<!--- create an instance of our PayflowPro component --->
   <cfset payflowpro = createObject("component","PayflowPro").init("C:\Program Files\Apache Group\Apache2\htdocs\paypal\Verisign.jar")>
   <!--- set the certificate path --->
   <cfset payflowpro.setCertPath("C:\Program Files\Apache Group\Apache2\htdocs\paypal\certs")>
   <!--- setup the context --->
   <cfset payflowpro.createContext("test-payflow.verisign.com",443,30)>   
   <!--- the param list --->
   <cfset payflowpro.setParamList(user,vendor,partner,pwd,trxtype,tender,acct,expdate,accttype,amt,currency,cvv2,street,city,state,country,zip,firstname,lastname,clientip,comment1,comment2,custref,invnum)>
   <!--- submit the transaction, returns a string --->
   <cfset response = payflowpro.submitTransaction()>
   <!--- destroy the context --->
   <cfset payflowpro.destroyContext()>

I am really looking for people who are looking to do processing with PayflowPro so I could get others thoughts on the library and how to use it. Any comments or questions are welcome so please feel free to leave them.

Comments

#1 Posted By: Steve Rittler Posted On: 2/9/07 9:28 AM
I have used the Payflow Pro stuff for a few years now. I hated having to set up the CFX tag and would be willing to test out the all-CF approach if you still want feedback. We wrapped the whole process in a CFC already, so it should be fairly trivial to remove custom tag calls and replace them with a few method calls.
#2 Posted By: Dan Posted On: 2/9/07 11:10 AM |
Author Comment
Steve,
It still uses the PayflowPro java class files except this way you can just load them at runtime. I should have something for you begining of next week. Thanks for helping out as well. Before I let everyone use this I want to be sure it works correctly.
#3 Posted By: Dan Posted On: 2/9/07 2:44 PM |
Author Comment
Steve,
What do you do with the response. In other words when you submit a transaction Paypal (or Verisign) will send you back a response with a number of attributes. If the result is 0 it passed else there are hundreds of error codes for different reasons. Do you just tell the user that the transaction failed or do you display more information to the user based on the error code. If so I was thinking of creating a dbase table for the error code lookups. Please feel free to contact me on gmail or gtalk so we can talk more about this. (danvega at gmail dot com).
#4 Posted By: Steve Posted On: 2/9/07 2:48 PM
We have all of those codes in a database table (MSSQL)...I can extract it as a CSV or whatever and put it somewhere for you to use if you want. We try to be as user-friendly as possible in our error messages, especially when something has gone wrong that the user can correct.
#5 Posted By: Dan Posted On: 2/9/07 2:55 PM |
Author Comment
Are the error codes similar to this https://www.paypal.com/IntegrationCenter/ic_api-er... . I am putting all of those into a table right now
#6 Posted By: Steve Posted On: 2/9/07 5:45 PM
Nope...they're completely different. the (formerly) Verisign PayFlow error codes are not the same as the PayPal codes.
#7 Posted By: Steve Posted On: 2/9/07 5:47 PM
See https://www.paypal.com/IntegrationCenter/ic_payflo...

Page 51+ of the developer's guide (PDF)
#8 Posted By: Brian Posted On: 2/21/07 3:28 PM
Hi Dan,

Wow! This sounds like a life saver. Im looking to do processing with payflow pro.
I've been struggling with setting up Payflow pro on my current server, basically due to not being able to install Jar files and use other java functions such as createObject on the server. Im in the process of moving my site over to Hostmysite.com I would be pleased to implement code like this on my site and give you feedback. Thanks Dan,

Brian
#9 Posted By: Dan Posted On: 2/21/07 3:32 PM |
Author Comment
Brian,
Does Host My Site allow you access to createOjbect()? You will still need that ability but you wont have to install any jar files, you can load them at runtime.
#10 Posted By: Brian Posted On: 2/22/07 1:47 PM
Yeah, their tech guys have assured me that they have coldfusion sandboxes setup in such a way that I can use creatObject without having to purchase a dedicated server... which I coudnt afford. do you have a different hosting recommendation?
#11 Posted By: Christine Posted On: 4/10/07 11:43 PM
Hi - I'm currently having issues with the PayFlowPro CFX tag on our CFMX7 clustered environment, I'd love to try your way and see if it fixed the issues. Can you possible email me the code?

Cheers
#12 Posted By: Andy Posted On: 8/14/07 9:28 PM
ARRRRRRRRRRGH. I have a customer I'm building a site for, and they have a hosting service that won't allow us to install anything. I've seen the https samples, but seeing how they're in PHP and I REALLY don't have time to learn it (I'd have to convert to CFML anyway), I'm REALLY keen on this wrapper approach.
#13 Posted By: Dan Posted On: 8/14/07 9:34 PM |
Author Comment
This is one of the reason I built this utility in the first place. Please give it a try and let me know if it works for you. There is more information about downloading it & using it on this site if you select the cfpayflowpro category on the right.


Post Your Comment

Leave this field empty







Show Captcha

If you subscribe, any new posts to this thread will be sent to your email address.

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.