Steve
Steve

Reputation: 23

PayFlowPro Integration Problems with ColdFusion and Curl

We have a very old ColdFusion website that we need to update for the upcoming PayPal SSL cert changes. We've found that the certs included with ColdFusion are not compatible with the new PayPal certs, so we need to use curl to actually make the calls to PayFlowPro. We'll call curl from ColdFusion using the cfexecute tag.

When I call PayFlowPro from the Linux command line using curl, the transaction completes correctly. For example, here is the script command that resulted in a successful transaction being processed.

curl https://pilot-payflowpro.paypal.com/transaction -d "PARTNER=VeriSign&PWD=xxxxxxxx&VENDOR=xxxxxxx&USER=xxxxxx&TENDER=C&ACCT=5105105105105100&TRXTYPE=S&EXPDATE=1215&AMT=2.02"

I then attempted to call curl from ColdFusion with the exact same name-value pairs as were in the script. The ColdFusion code was as follows:

<cfset targ = 'https://pilot-payflowpro.paypal.com/transaction -d "PARTNER=VeriSign&PWD=xxxxxxxx&VENDOR=xxxxxxx&USER=xxxxxx&TENDER=C&ACCT=5105105105105100&TRXTYPE=S&EXPDATE=1215&AMT=2.02"'>

<cfexecute name = "/usr/local/bin/curl"
       arguments = "#targ#"
       timeout = "10"
       variable = "tdata" />

<cfdump var="#tdata#">

ColdFusion returns the following: RESULT=4&RESPMSG=Invalid amount

Because the same name/value pairs were used in both calls, and the fact that 2.02 is a valid amount, I'm guessing it has something to do with the quotes or something unexpected being passed in at the end of the line. PayPal technical support cannot tell me what exactly is being passed in, and I haven't found any quote combinations that work.

Any assistance regarding the cause of the problem would be appreciated.

Upvotes: 2

Views: 365

Answers (2)

James Moberg
James Moberg

Reputation: 4475

You didn't mention which version of Adobe ColdFusion you were using. ColdFusion 8 & 9 has some bugs and can't connect to newer certificates and Adobe isn't going to fix it.

If you use Windows and have the ability to install it, I recommend using CFX_HTTP5. We recently had issues with many SSL certs and replacing built-in functionailty with this C++ tag has been extremely beneficial (especially since ColdFusion 8, 9 & 10 don't seem to get updates to fix this in a timely manner.) It uses the certificates that are install in Windows, but also has the ability to use client certificates.

We recently had an issue where an SSL certificate for a third-party API expired. CFX_HTTP5 had the ability to ignore the error and continue working whereas CFHTTP wasn't able to connect.

http://adiabata.com/cfx_http5.cfm

Upvotes: 1

Alex
Alex

Reputation: 7833

Try passing the arguments as an array:

<cfset targ = arrayNew(1)>
<cfset arrayAppend(targ, "https://pilot-payflowpro.paypal.com/transaction")>
<cfset arrayAppend(targ, '-d "PARTNER=VeriSign&PWD=xxxxxxxx&VENDOR=xxxxxxx&USER=xxxxxx&TENDER=C&ACCT=5105105105105100&TRXTYPE=S&EXPDATE=1215&AMT=2.02"')>

The snippet is compatible with ColdFusion MX.

If this doesn't work either, the total length of the arguments could be a problem (assuming your example is stripped). cfexecute might truncate the argument string silently. We encountered this issue on Windows though. Try to test curl on cfexecute with a shorter string (less than 200 characters).

Upvotes: 1

Related Questions