大家好! 我的 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,但没有成功。
我想说的是,我不是像你们这样经验丰富的编码员/程序员,我收到的每一条回复都将非常感激 :)
谢谢!
最佳答案
快速修复:
<input type="hidden" name="amount" value="<%# Eval("ProductPrice", "{0:0.00}").ToString().Replace(",", ".") %>">
关于c# - Paypal 按钮格式不正确的项目金额,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8338554/