2

我正在使用 Django 1.7 和 django-paypal。

我按照教程进行操作,一切正常。

然而,虽然支付表单是隐藏的,但我发现用户只需使用浏览器的 Inspect Element 功能就可以调整金额。

例如。

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input id="id_business" name="business" type="hidden" value="xxx@example.com">
<input id="id_amount" name="amount" type="hidden" value="10.0">
<input id="id_item_name" name="item_name" type="hidden" value="2">
<input id="id_notify_url" name="notify_url" type="hidden" value="http://www.example.com/pp/ipn/">
<input id="id_cancel_return" name="cancel_return" type="hidden" value="http://www.example.com/order/21/">
<input id="id_return_url" name="return" type="hidden" value="http://www.example.com/thank-you">
<input id="id_invoice" name="invoice" type="hidden" value="21"><input id="id_cmd" name="cmd" type="hidden" value="_xclick">
<input id="id_charset" name="charset" type="hidden" value="utf-8">
<input id="id_currency_code" name="currency_code" type="hidden" value="USD">
<input id="id_no_shipping" name="no_shipping" type="hidden" value="1">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Buy it Now">
</from>  

这是一个错误还是我在这里遗漏了什么?如何防止用户欺诈付款?我应该在 ipn 视图上验证付款吗?

4

1 回答 1

1

您创建的按钮代码是Clear text按钮,它不是托管按钮。为了防止按钮被篡改,我建议您创建一个托管按钮。创建步骤:

1) 登录 www.paypal.com

2) 导航到我的个人资料->我的销售工具或我的销售偏好

3) 点击“PayPal 按钮”旁边的“更新”

4)创建新按钮并输入所有必需的信息,

5) 在第 2 步中,选中复选框(Pay​​Pal 上的保存按钮),单击保存

在此处输入图像描述

托管按钮存储在 PayPal 上。与此类按钮相关的参数是安全的。托管按钮提供了最大的灵活性,因为您可以指示 PayPal 动态更改它们,并且 PayPal 维护有关其状态的信息,例如与按钮关联的库存水平。

于 2014-10-02T08:33:51.367 回答