Skip to main content
Inspiring
September 2, 2009
Question

CFHTTP/PayPal SetExpressCheckout Api

  • September 2, 2009
  • 1 reply
  • 3407 views

I am slowly but surely getting to grips with PayPal integration. I am trying to connect to their SetExpressCheckout API

I have a CFHTTP set up as a GET (also tried post)

It manages to authenticate me, but as soon as I give the CFHTTP a NAME="test_paypal" for example along with DELIMITER="&", it gives me a problem.

It says that the first variable returned which is TOKEN is an invalid name, it looks like this is a reserved name in CF?

I see this and a few other variables that I need using CFHTTP.FILECONTENT

Is there another way to correctly read all the variables returned without running into this issue?

Btw Any developers out there interested in working on this for me please let me know, I'll be on this for a lifetime at this rate!

Thanks

Mark

This topic has been closed for replies.

1 reply

ilssac
Inspiring
September 2, 2009

What does the code look the that is throwing the error?

If it is, as I suspect, when you try to reference the variable and you are using 'dot' notation.  This can almost always be resovled by using 'array' notation.

I.E. if you are using something like payPal.token and it is throwing an error, you can get to the same data with payPal["token"].

ACS LLCAuthor
Inspiring
September 2, 2009

Hi Ian,

Here is the code, and the server response that I get. If I try to use NAME= , it just goes into invalid variable for TOKEN

<CFHTTP URL="#serverURL#" METHOD="post" THROWONERROR="YES" delimiter="&" >

<CFHTTPPARAM NAME="METHOD" VALUE="SetExpressCheckout" TYPE="FormField"

ENCODED="YES">
<CFHTTPPARAM NAME="USER" VALUE="#APIUserName#" TYPE="FormField" ENCODED="YES">
<CFHTTPPARAM NAME="PWD" VALUE="#APIPassword#" TYPE="FormField" ENCODED="YES">
<CFHTTPPARAM NAME="SIGNATURE" VALUE="#APISignature#" TYPE="FormField"

ENCODED="YES">
<CFHTTPPARAM NAME="VERSION" VALUE="#version#" TYPE="FormField" ENCODED="YES">

<CFHTTPPARAM NAME="AMT" VALUE="1.00" TYPE="FormField" ENCODED="YES">

<CFHTTPPARAM NAME="RETURNURL" VALUE="http://www.xxxxxxxxxxx.com/buy.cfm"

TYPE="FormField" ENCODED="YES">

<CFHTTPPARAM NAME="CANCELURL" VALUE="http://www.xxxxxxxxxxxxxx.com"

TYPE="FormField" ENCODED="YES">


</CFHTTP>

<CFOUTPUT>


#cfhttp.fileContent#
</CFOUTPUT>

server gives

TOKEN=EC%2d5HNxxxxxxxxxxxxxT&TIMESTAMP=2009%2d09%2d02T20%3a50%3a33Z&CORRELATIONID=52f09a0972424&ACK=Success&VERSION=59%2e0&BUILD=000000

Now if I add the NAME, I get

Error Occurred While Processing RequestThe web site you are  accessing has experienced an unexpected error.
Please contact the website  administrator.

The following information is meant for the website developer for  debugging purposes.
Error Occurred While Processing Request

The column  name TOKEN=EC%2d5T01xxxxxxxxxx42G is invalid.

Column names must be valid variable  names. They must start with a letter and can only include letters, numbers, and  underscores.
The  error occurred in D:\ACS\paypal\index.cfm: line 27
25 : <CFHTTPPARAM NAME="RETURNURL" VALUE="http://www.xxxxxxxxxxx.com/buy.cfm" TYPE="FormField" ENCODED="YES">
26 :
27 : <CFHTTPPARAM NAME="CANCELURL" VALUE="http://www.xxxxxxxxxxx.com" TYPE="FormField" ENCODED="YES">
28 :
29 :
ilssac
Inspiring
September 2, 2009

What do you mean by "Add Name"

Where are you adding a Name property and how are you trying to use it?