3
votes

I'm trying to implement the CFC (coldfusion) code found here:

http://www.sitekickr.com/blog/integrating-paypal-payflow-pro-rest-api/

I'm still at the testing stage and haven't even tried passing my own variables, just using the CFSET example provided.

<cfset response = paypal.capture( card_type = "visa"
      , card_number = "4556747948786484"
      , card_exp_month = "12"
      , card_exp_year = "2018"
      , card_firstname = "Bob"
      , card_lastname = "Smith"
      , amount = 15.25
      , description = "Order 1011"
 )> 

I'm getting this error:

{"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount.total","issue":"Currency amount must be non-negative number, may optionally contain exactly 2 decimal places separated by '.', optional thousands separator ',', limited to 7 digits before the decimal point"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"dfb7b0588d38e"}

It makes no sense because the currency value I'm passing is NOT a negative and contains only two decimal places. There is no obvious error with the "amount" value I'm passing.

So I'm stuck.

1
What does your request look like? - Matt Busche
At this point, I'm just sending over the sample CFSET <cfset response = paypal.capture( card_type = "visa", card_number = "4556747948786484", card_exp_month = "12", card_exp_year = "2018", card_firstname = "Bob", card_lastname = "Smith", amount = 15.25, description = "Order 1011")> - howardowens
So, I just discovered that I can go into my PayPal developer account and under the Sandbox menu and Transactions, get more detail on what I'm passing. For total, I'm passing: "total": "15.25|||" ... so somehow, I have extra spaces there ... don't know why yet, but that appears to be the case. - howardowens
In the CFC at line 57 the total variable is set and formatted, part of the formating includes: " & "|||" I removed that bit and the transaction processed successfully. - howardowens
If you think the solution will be helpful to someone else, you should consolidate the last two comments and post them as an "answer". (Answering your own question is allowed on S.O.) - Leigh

1 Answers

1
votes

Here's how I solved my problem.

I discovered that in my PayPal developer account, I could go to the menu Sandbox/Transactions and get more details on transaction attempts.

Through this, I discovered the value I was actually passing for total was "15.25|||"

PayPal was receiving: "total": "15.25|||"

Upon further investigation, at line 57 of the CFC, I found

"total"= (NumberFormat(arguments.amount, "9.99")) & "|||",

I removed the: & "|||"

And got a successful response from PayPal's sandbox.