信用卡重复交易

发布于 2024-07-17 07:54:07 字数 65 浏览 8 评论 0原文

防止用户进行重复信用卡交易的最佳方法是什么? 无论是点击提交按钮太多次,还是从收据页面导航回来并再次点击提交按钮。

What's the best way to prevent a user from making duplicate credit card transactions? Be it by clicking the submit button too many times, or by navigating back from the receipt page and clicking the submit button again.

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

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

发布评论

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

评论(6

任性一次 2024-07-24 07:54:07

您可以生成一个唯一的值,并将其置于隐藏的形式中。 在向信用卡收费之前,请确保该唯一值尚未被处理。 再加上 CodeToGlory 禁用该按钮的建议应该可以解决您的两个用例。

You could generate a unique value, and put it in a hidden form. Before you charge the credit card make sure this unique value has not been processed already. This coupled with CodeToGlory's suggestion of disabling the button should resolve both of your use cases.

鸵鸟症 2024-07-24 07:54:07

有几种方法:

  1. 单击按钮后立即禁用该按钮。

  2. 有一个批处理程序可以在当天晚些时候从结算中删除重复项,这样他们就不会被收取费用。

    有一个批处理程序可以在当天

  3. 使用某种模式窗口来阻止用户导航,直到处理信用卡交易为止。 Jquery 有可以为您工作的 block.UI 插件。

Couple of ways:

  1. Disable the button immediately after clicking it.

  2. Have a batch process to remove duplicates from settlement later in the day, so they won't get charged.

  3. Use some kind of modal window to stop the user from navigating till the credit card transaction is processed. Jquery has block.UI plugin that can work for you.

稀香 2024-07-24 07:54:07

大多数银行要求您提供唯一订单 ID,因此无法对同一订单收取两次费用。

现在,如果您要求防止重复提交,标准方法是 发布/重定向/获取模式。 您还可以将其与使用 JavaScript 停用提交按钮结合起来。

您需要:

  1. order_form.aspx,生成唯一订单ID并通过POST提交到
  2. proces_order.aspx执行实际工作,清空购物篮,然后重定向
  3. thankyou.html

现在,如果用户单击重新加载,则仅重新加载静态thankyou.html。 如果他选择点击返回,则返回到 order_form.aspx,但他的购物篮已经空了。 如果以某种方式进行缓存,它将使用相同的订单 ID 进行缓存,因此不会有收取两次费用的风险。

Most banks require that you provide unique order ID, so there is no way of charging twice for the same order.

Now, if you're asking for prevention of duplicate submit, the standard way is the Post/Redirect/Get pattern. You might also combine that with deactivating submit button with JavaScript.

You'd have:

  1. order_form.aspx, generating unique order ID and submitting by POST to
  2. proces_order.aspx doing the actual work, emptying the basket, and then redirecting to
  3. thankyou.html

Now, if user clicks reload, only reloads static thankyou.html. If he chooses to click back, get's back to order_form.aspx, but his basket is already empty. Should it somehow be cached, it'll get cached with the same order ID, so no risk of charging twice there.

勿忘心安 2024-07-24 07:54:07

向后端系统添加某种同步机制,以便在任何一个时间点都可以只有一个线程将“待收费”记录处理到底层数据源中。 在此同步区域内,添加检查以确保数据源中尚不存在即将处理的费用。 如果确实发生这样的错误,请确保向客户输出某种优雅的消息 - 至少它不会在后端造成致命的后果。

正如 CodeToGlory 所建议的,它还有助于在 UI 级别添加第二层保护。 这将最大限度地减少这种情况发生的次数。

Add some sort of synchronization mechanism to your back-end system so that only one thread may be processing 'to be charged' records into your underlying datasource at any one point in time. Inside this synchronized region, add a check to ensure that the charge that is about to be processed does not already exist in the datasource. If such an error does occur, make sure to output some sort of graceful message to the customer - at least it won't be fatal on the back end.

It also helps to add a 2nd layer of protection at the UI level, as suggested by CodeToGlory. This will minimize the number of times that this occurs.

能否归途做我良人 2024-07-24 07:54:07

订购后立即删除购物篮中的商品并禁用提交按钮。

在这种情况下,即使用户回来、刷新等也不能购买两次,因为购物篮中将没有任何东西可购买。

Remove the basket items as soon as they ordered and disable the submit button.

In this case even if the user comes back, refresh etc. can't buy twice since there will be nothing in the basket to buy.

不甘平庸 2024-07-24 07:54:07

您可以在客户进入第一个结帐页面时创建会话,然后在按下提交按钮时强制会话超时。 这样客户就必须重新开始结账过程。

You can create a session when the customer enter the first check out page, and then when the submit button is pressed, force session timeout. That way the customer has to start over the checkout process again.

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