PayPal错误“货币金额必须为非负数" [英] PayPal error "Currency amount must be non-negative number"

查看:193
本文介绍了PayPal错误“货币金额必须为非负数"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现在此处找到的CFC(冷熔)代码:

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

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

我仍处于测试阶段,甚至没有尝试使用提供的CFSET示例传递我自己的变量.

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"
 )> 

我收到此错误:

{"name":"VALIDATION_ERROR","details":[{"field":"transactions [0] .amount.total","issue":"Currency 金额必须为非负数,可以选择正好为2 小数位,以."分隔,可选的千位分隔符,", 限制为小数点前7位数字}]," message:"无效 请求-请参阅 详细信息","information_link":" https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR ," debug_id:" dfb7b0588d38e}

{"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.

所以我被困住了.

推荐答案

这是我解决问题的方式.

Here's how I solved my problem.

我发现在我的PayPal开发人员帐户中,我可以转到菜单沙箱/交易"并获取有关交易尝试的更多详细信息.

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

由此,我发现我实际传递的总值是"15.25 |||"

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

PayPal收到:总计":"15.25 |||"

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

进一步调查后,我发现在CFC的第57行

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

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

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

我删除了:& "|||"

I removed the: & "|||"

并且从PayPal的沙箱中获得了成功的响应.

And got a successful response from PayPal's sandbox.

这篇关于PayPal错误“货币金额必须为非负数"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆