Getting Started With PayPal’s Payflow Pro

In my last post we talked about PayPal purchasing Payflow Pro. In this post we will talk about how to integrate it into your current application. The first thing you need to do is sign up for a business account. To get started visit PayPal's getting started page.

Once you have signed up for account your ready to start coding. First sign in to your Payflow Pro manager and click on the downloads buttons in the upper right hand corner. Underneath the integration packages section you will see a ColdFusion Option. You have to accept some agreements and then you will be prompted to download CFX_PFPro_Java.zip. In the download there is a Users guide which has detailed installation instructions. I am going to go through the short installation procedure, for detailed instructions please use the guide.

Requirements
First off we are going to go over a list of requirements. Please make sure you meet these requirements before moving forward.

  • Web server running Macromedia ColdFusion v4.5, v5.x, MX v6.x, MX v7.x
  • MX v6.x and x7.x users:
    You must pass the proxy and parmlist variables along with the host address, host port,
    and timeout value. If the PARMLIST and PROXY variables are not being used, then you
    must still pass a NULL character for these variables. Example: PARMLIST=””,
    PROXYADDRESS=””
  • Sun’s Java JRE version 1.3.1_02 or higher. Available at http://java.sun.com/j2se/
  • Before you can test this system, you must have registered for a VeriSign Payflow Pro
    account at http://www.verisign.com/products-services/payment-processing/onlinepayment/
    payflow-pro/index.html. The registration is free for testing purposes.

Installation

  1. Move both the Verisign.jar and CFXPayFlowPro.class files from the PFProColdFusion directory into a directory that is in your classpath.
  2. Add /Verisign.jar to the end of the current class path. You can do this through the ColdFusion Administrator under JVM and Java Settings.
  3. Select the CFX Tags section of the ColdFusion administrator.
  4. Create a new Java tag:

    Tag Name: CFX_PAYFLOWPRO
    Class Name: CFXPayFlowPro
    Description: CFXPayFlowPro
    Note: The Class Name is case-sensitive and does not include the .class extension. The Tag
    Name must be entered as shown above.
  5. Stop and Restart your ColdFusion server service to initialize the changes. (Any time the
    *.jar files are moved or changed, you must restart ColdFusion to initialize the changes).
  6. Copy the certs directory from the PFProColdFusion to a location of your choice. The certpath variable will be set in your calling code which we will get to in a minute.
  7. Time to run some code and do some testing.

The Code
Below is an example of how to implement the CFX_PayFlowPro tag.

QUERY = "RESULT"
HOSTADDRESS ="test-payflow.verisign.com"
HOSTPORT = "443"
TIMEOUT = "30"
PROXYADDRESS = ""
PROXYPORT = ""
PROXYLOGON = ""
PROXYPASSWORD = ""
TRXTYPE = "S"
TENDER = "C"
PARTNER = "PayPal"
USER = "PayPalLoginID"
PWD = "PayPalpassword"
ACCT = "5105105105105100"
EXPDATE = "1209"
AMT = "27.33"
COMMENT1 = "This is a comment - noautomatically escaped"
COMMENT2 = "Embedded = and & work when escaped"
CERTPATH = "C:\Inetpub\wwwroot\CFIDE\certs">

Attribute List
Here is the minimum list of attributes to pass when using the tag. Please stay tuned to further postings as I will discuss the full list of attributes.

  • Query The name of the query result. Use the QUERY parameter after the transaction has been processed to identify this transaction
    and get the results.
  • HostAddress The HOSTADDRESS parameter specifies the VeriSign transaction server against which to
    process. test-payflow.verisign.com is used for test transactions, and payflow.verisign.com is
    used for live transactions.
    HOSTADDRESS is a required field and should always have a value. If the value is left empty (“”),
    then the tag gives an SSL error instead of a host address connection error.
  • TRXTYPE A single character indicating the type of transaction to perform. Website Payments Pro Payflow Edition supports the following values:
    S = Sale transaction
    A = Authorization
    C = Credit
    D = Delayed Capture
    V = Void
  • Tender The tender type (method of payment). Values are:
    @ C = Credit card for Direct Payment transactions
    @ P = PayPal for Express Checkout transactions
  • ACCT
  • AMT The amount of the sale
  • EXPDATE The expiration date of the credit card
  • CERTPATH This is the fully qualified path of where the certs folder was copied to during step 6 of our installation process.

In conclusion I have a couple customers running this solution at the time of this post. Everything is running great so If you have any problems please send me an email and I will try and help you out.
NOTE: IF YOU ARE ALREADY USING THE VERISIGN SOLUTION THAN DO NOT BOTHER WITH THE INSTALLATION PROCESS, THE CURRENT FILES WILL WORK FOR BOTH VERISIGN AND PAYPAL. THE ONLY DIFFERENCE WILL BE THE PARTNER ATTRIBUTE PASSED THROUGH THE TAG.

Categories: ColdFusion,Web Development

About The Author

My name is Dan Vega and I am a Software Developer based out of Cleveland OH. I love to play with new technologies and write about my experiences here. When I am not busy being a full time geek I love to lift heavy weights and hang out with friends and family. If you have any questions please don't hesitate to contact me.

Follow me on:
  • http://www.bennadel.com Ben Nadel

    Dan, I know that this post is fairly old, but had a quick question; I am testing some payflow pro code and the request is timing out really quickly, like 4 seconds. However, in the CFX tag attributes, I have a 45 second timeout. Do you have any idea as to whether this really quick timeout indicates anything special?

  • http://therealdanvega.com Dan Vega

    Does PP give you any kind of error code back? The first thing I would double check is the address, port and proxy attributes if you are using one. Please feel free to email me, I have done tons of work with PP and I should be able to help.

  • http://www.bluetangerinesolutions.com Greg Bray

    I’ve been looking through the downloads on the payflow pro manager and I’m not finding the CFX_PAYFLOWPRO tag anywhere. Am I just blind, or is it not there anymore? If not, is it available anywhere else?

    Thanks.

  • PayPal User

    Greg, I submitted a support ticket at http://www.paypal.com/mts and a support person emailed me the tag. Technically it is no longer supported by them, so they do not have it for general download availablity.

  • SBach

    Dan,
    I’ve followed your instructions to a T. I have the 2 payflow pro files in c:\classpath and i’ve added that to the custom tag path. I’ve added the CFX tag exactly as you referenced. When I try to run the PFProCFXtest.cfm test page we are getting this error:
    Error processing CFX custom tag "CFX_CFXPayFlowPro".
    The CFX custom tag "CFX_CFXPayFlowPro" was not found in the custom tag database.

    I’m not sure where the extra CFX is coming from. We are on CFMX7. I’ve got this running on 3 other webservers and we are adding a new server to the mix. I’ve copied everything exactly as it is on the functioning servers but still get the same error. Oddly when i remove the cfx tag i get the error message i would expect without the duplicate cfx in the name. Any ideas?

  • http://therealdanvega.com Dan Vega

    Are you stopping and restarting the server after you install the cfx tag?

  • http://therealdanvega.com Dan Vega

    and you can see the versign.jar in your classpath?

  • Shawn

    Hi Dan, great writeup!

    I’m wondering what the best way would be to integrate payflo pro with a Flash-based shopping cart?? Is it possible?
    Thanks,

  • EstebanD

    As I commented on Ben Nadel’s Blog.

    Just the heads up. On Sept 1st 2009 this method will be deprecated and it will stop working.

    The cutoff date will deprecate the CFX custom tag.
    See: https://www.paypal.com/gatewayupdate

    Ryan Stille has kindly provided an almost drop in replacement custom tag that uses standard CF tags.

    http://cf_payflowpro.riaforge.org/

    http://www.stillnetstudios.com/cfx_payflowpro-drop-in-replacement/