Test that a double click does not create two orders
A slow Pay button gets clicked twice and the customer is charged twice. Test what a hurried person does, then check exactly one order exists, not the thank-you page.

The click nobody tests#
A customer presses Pay. The spinner takes two seconds to appear, so they press it again. Two requests reach the server, two orders are created, and the card is charged twice.
Payment providers know this case well. Checkout.com lists a customer pressing the payment button several times in quick succession as one of the ways genuine duplicate transactions happen. A developer on Square's forum traced duplicate charges to a mouse that sent a double click when it was pressed once. Write-ups of the fix are everywhere (one, two): disable the button on the first click, and make the server ignore a repeat of the same request (an idempotency key).
The same bug hides in every form that creates something: sign-ups that make two accounts, bookings that take two slots, a "Send invite" that sends two emails.
Why the usual tests miss it#
A scripted test clicks once, waits for the next page and moves on. It proves the happy path and says nothing about the second click. A person in a hurry does not wait.
The test#
Say what the hurried person does, then check the outcome somewhere other than the confirmation page.
Sign in as the account "shopper".
Add "Blue mug" to the cart and go to checkout.
Fill in the test card and press "Place order" twice, quickly,
the second press before the page changes.
Wait for the confirmation page.
Open "My orders" and check exactly one new order for "Blue mug"
is listed, dated today.Two details make it a real check:
- Count, do not just look. "Exactly one new order" is a check the tester can fail. "The order was placed" passes even when there are two.
- Check where duplicates show. The orders list, the account's order count, or the emails the run's mailbox received: two confirmation emails for one order is the same bug, seen from the inbox.
Use your payment provider's test mode for the card; Test Stripe checkout and plan upgrades has Stripe's test cards and rules.
What a browser test proves, and what it does not#
It proves what the app does when a person double-clicks: the button was disabled in time, or the server refused the second request, and the customer ended up with one order. It does not prove the server is safe when a network retry or a load balancer repeats a request without any click. That is a test of your API, with the same request sent twice in code.
Run the browser test on every release anyway. The disabled button is front-end code, and front-end code is what a redesign rewrites (tests that survive a redesign).
The same test, other forms#
- Sign-up: press "Create account" twice, then check the run's mailbox received one welcome email.
- Booking: press "Book" twice, then check one booking appears and the slot count dropped by one.
- Invite: press "Send invite" twice, then check the member list shows the address once.
We have not run the checkout version of this test for this post. The test text above is the pattern; change the names to your own.
This post is part of Release testing for product teams.
Filed underWebHard interactionsForms and checkoutReleases and regressions