Hello. My name is Noemi Millman, and Triopter is my web development agency. We handcraft beautiful, dynamic websites.

See what I can do for you.

Noemi Millman: Triopter: Installing Payflow Pro on Mac OS X

Installing Payflow Pro on Mac OS X

If you’ve done more than a little web development, you’ve probably encountered Payflow Pro, PayPal’s (previously Verisign’s) credit card processing solution.

It’s not supported on OS X.

But OS X is UNIX-y! There’s a version for Linux! Why won’t it work on OS X? Can’t you google for installation instructions?

Well, no. Perhaps my google-fu is weak, but I could find no information whatsoever about how to get it working.

In fact, if these guys hadn’t pointed out that it was possible, I would have given up then and there.

But I got it installed. And you can, too. Here’s how:

  1. Make sure you have the Apple Developer Tools installed.
  2. Download the Payflow Pro Java SDK (you have to log into a Payflow Pro account to get the download), and unzip it to your hard drive (it doesn’t matter where, as long as it’s a place where the user your web server runs as can get to it).
  3. cd into the java directory.
  4. Set your paths. I had trouble getting these to stick, so I’d love any suggestions anyone might have on that aspect:

    $ CLASSPATH=${CLASSPATH:-}:Verisign.jar:.;export CLASSPATH

    $ libpath=.:../jni:../lib


  5. Compile the java code:

    $ javac PFProJava.java

  6. Run a test transaction:

    $ java PFProJava test-payflow.verisign.com 443 "USER=YourUserName&VENDOR=YourVendorName&PARTNER=YourPartnerName&PWD=YourPassword&TRXTYPE=S&TENDER=C&ACCT=5105105105105100&EXPDATE=1209&AMT=1.23&ZIP=12345&comment1=Test JNI Transactions" 30

    Don’t forget to insert the correct user/vendor/partner/password.

    Oh, and when I tried it with an account that didn’t have a username (which is possible in payflow pro), it wouldn’t accept the transaction until I set the USER to be the same as the VENDOR.

  7. I ran into another problem, which was that I kept getting a NoClassDefFoundError even after following the above steps. I fixed this by adding the absolute path to Verisign.jar to my CLASSPATH:

    $ CLASSPATH=${CLASSPATH:-}:/path/to/directory/Verisign.jar:.;export CLASSPATH

  8. As I mentioned, I had a lot of trouble getting the CLASPATH to stick. I couldn’t even run the binary from another directory – even if I speicified the full path to it. In the end, the following sequence was the most reliable means of running a successful transaction:

    $ cd /path/to/binary/

    $ CLASSPATH=${CLASSPATH:-}:Verisign.jar:/path/to/directory/Verisign.jar:.;export CLASSPATH

    $ java PFProJava test-payflow.verisign.com 443 "USER=YourUserName&VENDOR=YourVendorName&PARTNER=YourPartnerName&PWD=YourPassword&TRXTYPE=S&TENDER=C&ACCT=5105105105105100&EXPDATE=1209&AMT=1.23&ZIP=12345&comment1=Test JNI Transactions" 30

    Again, I’d gladly welcome suggestions as to how to make this work more fluidly.

That’s that. You’ve got it installed. The following code will suffice to call it from PHP:

$pfpro_path = '/path/to/directory';

$pfpro_server = 'test-payflow.verisign.com'; // for test transactions. Change this for live transactions.

$vars = '?your=values&to=submit&to=verisign'; // build this string appropriately from your variables according to the payflow documentation, and don't forget to run escapeshellcmd() on each one, since we'll be passing this to exec().

$cmd = 'cd "' . $pfpro_path . '; "; CLASSPATH=${CLASSPATH:-}:"' . $pfpro_path . '}Verisign.jar":.; export CLASSPATH; cd "' . $pfpro_path . '"; java PFProJava ' . $pfpro_server . ' 443 "' . $vars . '"'

$result_code = exec($cmd, $result_string);


Good luck…. and if you happen to figure out that whole path issue, drop me a line!

  1. COMMENT: by adamcoop, August 19th, 2007

    Thank you thank you thank you!

    I’m setting up an ecommerce site for a client, and realised the shortcomings of Payflow Pro and OS X AFTER organising Payflow and hosting.

  2. COMMENT: by Noemi Millman, August 19th, 2007

    adamcoop –

    Paypal apparently is now testing a brand-new API that requires only cURL, rather than the Paypal SDK. If you can’t get the SDK working, it may be worth asking support about the new API.

    Anyhow, best of luck!

Post a Comment

Your email is never published nor shared. Required fields are marked *

Comments may be held for moderation to prevent spam: your comment may not appear immediately.