当作为隐藏输入字段提交时,如何防止用户覆盖购物车中的总成本?

发布于 2024-09-01 00:42:58 字数 322 浏览 3 评论 0原文

我在接受付款方面遇到严重问题。

我正在隐藏字段中传递总金额。

<input type="hidden"
  name="checkout-flow-support.merchant-checkout-flow-support.shipping-methods.flat-rate-shipping-1.price"
  value="129.00"/>

一些用户使用 firebug 将此值更改为 2 并提交了表单。我们没有得到 129 美元,而是只收到了 2 美元。

我不知道如何进行此操作,任何人都可以快速帮助我。

I'm having serious problems with accepting payments.

I'm passing the total amount in a hidden field

<input type="hidden"
  name="checkout-flow-support.merchant-checkout-flow-support.shipping-methods.flat-rate-shipping-1.price"
  value="129.00"/>

Some of the users changed this value to 2 using firebug and submitted the form. Instead of getting $129, we only received $2.

I have no idea how to proceed this anyone help me quick .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

输什么也不输骨气 2024-09-08 00:42:58

我在隐藏字段中传递了总金额

不要这样做!

由于您知道用户尝试购买哪些商品,因此请计算服务器端的成本。

im passing the total amount in a hidden field

Don't do this!

Since you know what items the user is attempting to purchase, calculate the cost server side.

梦情居士 2024-09-08 00:42:58

这是一个教科书式的错误,类似于在实体店询问顾客该商品的价格并相信他的回答。这是一般安全原则的一个特例:不信任客户端。霍博达夫的回答是正确的;在服务器端计算价格、税金等。

This is a textbook error, analogous to asking a customer at a brick-and-mortar store how much the item costs and trusting that response. It is a special case of the general security principle: don't trust the client. Hobodave's answer is correct; calculate prices, taxes, etc. server-side.

风吹雪碎 2024-09-08 00:42:58

对于支付服务提供商 (PSP),一般通信设置通常如下所示:

1) 您的服务器联系 PSP 并设置交易,指定所需金额和您的 PSP 帐户详细信息。

2) PSP 使用事务标识符进行响应,然后您将其添加到表单中。该交易标识符不包含有关所涉及价格的信息 - 它只是您的服务器与 PSP 设置的交易记录的标识符。

3) 访客填写表格并发送给 PSP。然后他们将访问者重定向回您的网站。

4) 您的服务器查询 PSP 服务器并检查交易是否成功(即访问者的付款方式是否与 PSP 进行了交易等)

服务器到 PSP 的通信通常使用诸如curl 之类的库来完成。

Google 提供了许多有关如何正确处理交易的库/示例(根据我的经验,大多数其他 PSP 也这样做):
http://code.google.com/apis/checkout/samplecode.html

确切的通信细节可能会因 PSP 的不同而有所不同,但基本上不需要通过向访问者显示的表格来显示“总金额”。这一切都是在服务器到服务器之间完成的,因此访问者不可能更改详细信息。

With Payment Service Providers (PSPs), the general communication setup typically goes something like:

1) Your server contacts the PSP and sets up the transaction, specifying the amount required and your PSP account details.

2) The PSP responds with a transaction identifier, which you then add to the form. This transaction identifier holds no information about the prices involved - it's simply an identifier to the transaction record your server set up with the PSP.

3) Visitor fills out form which is sent off to the PSP. They then redirect the visitor back to your site.

4) Your server queries the PSP server and checks that the transaction succeeded (ie. the visitors payment method OK'd the transaction with the PSP, etc)

The server-to-PSP communication is typically done using a library such as curl.

Google provide a number of libraries / examples on how to correctly process transactions (and most other PSPs do the same, in my experience):
http://code.google.com/apis/checkout/samplecode.html

The exact communication details may vary depending on the PSP, but basically there should not be any need to have the "total amount" ever go through the form displayed to the visitor. It's all done server-to-server so that the visitor cannot possibly change the details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文