【发布时间】:2011-12-01 08:45:21
【问题描述】:
干杯,伙计们! 我的 ASP.NET C# 项目中的 paypal 按钮出现问题,每当我单击“添加到购物车”时,paypal 都会给我以下错误:
“您用于进入 PayPal 系统的链接包含格式不正确的项目金额。”
我的按钮如下所示:
<form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="MyEmail@Email.com">
<!-- Specify a PayPal Shopping Cart Add to Cart button. -->
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<%# Eval("ProductName") %>">
<input type="hidden" name="amount" value="<%# Eval("ProductPrice", "{0:0.00}") %>">
<input type="hidden" name="currency_code" value="DKK">
<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif"
alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
</form>
在我的 SQL 数据库中,我的“ProductPrice”是一个数据类型:decimal(18, 0) 我尝试将其更改为 datatype: money,但没有多大成功。
我想提一下,我不是像你们这样经验丰富的程序员/程序员,我收到的每一个回复都会非常感谢我 :)
谢谢!
【问题讨论】:
-
检查生成的 HTML。在该按钮所在页面的浏览器中,查看html源代码。查看为
amount设置的值是多少 -
你好二凡,为 Amount 生成的 HTML 是:
-
现在你看到了问题:) 它应该是 99.00 而不是 99,00。 PayPal 将只接受点 (.) 作为小数分隔符,不接受逗号
-
哦,快!这是一个问题是的!但正如我所提到的,我不是一个经验丰富的程序员,所以我想知道,我如何将它改为一个点?