I have done a lot of work with PayPal's api over the years, and one of the biggest frustrations I had for a long time was that their ColdFusion support was limited. In the more recent versions of their API they have provided the ColdFusion development community with a CFC that interfaces with their Java API.

Then, when they dropped the requirement for a client-side .P12 certificate to be passed with each request as the only way to authenticate against their api, and added the option to use a signature string instead, they got close to a useful solution for the average CF developer.

The only thing that still causes many ColdFusion people to cringe and pull their hair out, is the fact that the PayPal.cfc returns a java object, which is something most CF developers don't deal with on a regular basis (if at all).

Fortunately for you, I have already taken the time to go through each of the API calls, and through the use of many cfdumps, I found every piece of information available in each of the responses, and then I put them into nice CF developer friendly ColdFusion structures.

[More]

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Brandon Hansen's Gravatar When I try to call the cfc I get this-

Object Instantiation Exception.
An exception occurred when instantiating a Java object. The class must not be an interface or an abstract class. Error: ''.

The error occurred in D:\Inetpub\livewebsystems\shop\paypal\paypal.cfc: line 27
Called from D:\Inetpub\livewebsystems\shop\paypal\paypal.cfc: line 16
Called from D:\Inetpub\livewebsystems\shop\paypal\paypal.cfc: line 1
Called from D:\Inetpub\livewebsystems\shop\paypal\index.cfm: line 5
Called from D:\Inetpub\livewebsystems\shop\paypal\paypal.cfc: line 27
Called from D:\Inetpub\livewebsystems\shop\paypal\paypal.cfc: line 16
Called from D:\Inetpub\livewebsystems\shop\paypal\paypal.cfc: line 1
Called from D:\Inetpub\livewebsystems\shop\paypal\index.cfm: line 5

25 :       <cfscript>
26 :          // Create CF caller object
27 :          pp_caller = CreateObject("java", "com.paypal.sdk.services.CallerServices");
28 :    
29 :          // Set API profile
# Posted By Brandon Hansen | 2/6/08 8:38 PM
Scott Bennett's Gravatar Did you follow these steps?

1 -Install the PayPal Java SDK.

2 -Copy a subset of the Java SDK JAR files to a location accessible by the ColdFusion
application server. The JAR files are in SDK_root\lib and their exact names are as
follows:
      bcmail-jdk14-128.jar
      bcprov-jdk14-128.jar
      paypal_base.jar
      paypal_stubs.jar
      sax2.jar
      xerces.jar
      xpp3-1.1.3.4d_b4_min.jar
      xstream.jar-1.1.3.jar

3 -With the ColdFusion Application Server Administrator, add the absolute path of the
location you determined in Step 2 to the Java and JVM CLASSPATH environment variable.

4 -Restart the ColdFusion Application Server.
# Posted By Scott Bennett | 2/6/08 8:50 PM
Scott Bennett's Gravatar To install the PayPal SDK you will need to go to:

https://www.paypal.com/IntegrationCenter/ic_sdk-re...

Then download the Java SDK file for your operating system. If you are on windows you will download the zip file.
# Posted By Scott Bennett | 2/6/08 9:14 PM
Brandon Hansen's Gravatar hmm...I'm on a shared server. Is there any way to do that?
# Posted By Brandon Hansen | 2/6/08 9:36 PM
Scott Bennett's Gravatar You will need to contact your hosting provider for that.
# Posted By Scott Bennett | 2/6/08 9:39 PM
Tim Meade's Gravatar Hi Scott,

Does this need to be updated for the latest paypal SDK? I just installed the SDK and some of the jar files (bc* for example) are not in the /lib directory.

Also, what about recurring billing? Are you planning on adding them to the cfc?

Thanks,

Tim
# Posted By Tim Meade | 5/8/08 11:20 AM
Scott Bennett's Gravatar @Tim,

Currently this CFC only handles the Direct Payment and the Express Checkout API calls. This worked with the paypal java sdk that you can download here:

https://www.paypal.com/IntegrationCenter/ic_sdk-re...

I have not worked it in several months, but I just downloaded the latest zip of the java sdk and it does look like the files are different. Whenever I have some free time I will look into what it will take to update my CFC.
# Posted By Scott Bennett | 5/8/08 2:07 PM
Len Engel's Gravatar Scott -- just getting into this -- did you come up with some changes to the cfc regarding the missing bc* files?
# Posted By Len Engel | 3/14/09 1:24 PM
Scott Bennett's Gravatar @Len,

I have been working on a really big Flex project lately, and haven't really had any free time for blogging, and I haven't done a paypal integration for a long time, so I'm not yet current with the new version of the SDK.
# Posted By Scott Bennett | 3/14/09 3:54 PM
Francesco's Gravatar Is this component still working?

I have trouble to make it work. got error
# Posted By Francesco | 11/15/12 12:24 AM
 
Home | Blog | Portfolio | Contact | © 2001 - 2007 The ColdFusion Guy - Scott Bennett. All rights reserved.
BlogCFC was created by Raymond Camden. This blog is running version 5.9.