Índice do artigofaltam 3 min de leitura
Your customer picks the product, checks the amount and taps pay. The screen keeps spinning. A few seconds go by and neither a confirmation nor an error message appears. They do not know whether the payment went through and do what anyone would do: tap again. If the first attempt had already gone through, the same purchase shows up twice on their card statement, and the complaint lands at your company.
Anyone who charges through their own app, website or system has already received this complaint or fears receiving it. It is usually treated as bad luck, or as carelessness by whoever tapped twice. The second charge has two sources: the person who taps again and the app that repeats the request on its own when the connection fails. Stripe, a payments company used by stores and apps, has explained publicly how it prevents a repeated request from becoming a second charge.
Why doesn't the system know whether it charged?
In 2017, engineer Brandur Leach published on Stripe's blog how its system handles this. A payment is a conversation between two computers over the internet, and the connection can drop at three points in that conversation.
Your app asks the payment provider, the company that processes the charge, such as Stripe, to make the charge. The provider executes it and responds. Leach describes what happens when this conversation is interrupted at each of the points.
In the last two cases, the app sees the same thing: no response.
If the app tries again and the charge has already happened, the customer pays twice. Leach recommends trying again, because giving up also has a cost: in our view, that cost is the sale that gets lost without anyone noticing. A double charge turns into a refund and support hours. A lost sale does not even show up in the report.
The number that prevents the second charge
Think of a restaurant. The waiter writes the order on a numbered ticket and takes it to the kitchen. Unsure whether he was heard, he goes back and repeats the order, showing the same ticket. The kitchen looks at the number, sees that the order has already been entered and gives the same answer as the first time. If the impatient customer calls another waiter and orders again, the kitchen checks the same ticket and only one dish comes out.
The solution Stripe describes works like this. Your app creates the order number (the technical term is idempotency key) and sends it along with the charge, and the payment provider checks it. With this number, the request can be repeated as many times as needed and the customer is charged only once.
In practice, we create the number when the customer opens the payment screen, not on every tap of the button. That way the second tap arrives with the same number and does not become a second charge either.
Without the order number
Two charges on the statement- The customer taps again, or the app repeats on its own
- The provider treats it as a new request
- It charges again
With the same number
A single charge- The repeated request carries the number from the first time
- The provider recognizes the number
- It returns the stored response, without charging
The technical name for this is idempotency: the operation can be repeated without happening twice. It is the word your team will use.
Amazon uses the same principle in its own cloud services, as explained in the Builders' Library, where its engineers describe how its systems were built.
What the customer sees also matters
The other half is the screen. X-Apps, the software company that writes this blog, took care of it in BigPag, a digital account app. Before, according to the case study, keeping track of what had already been paid depended on memory and screenshots.
In the app, the payment goes through a review screen and then a confirmation screen. Afterward, it appears in the statement with its status, and the detail view keeps the identifier and a receipt ready to share. A failed transfer shows the reason right away, without the person needing to contact support. With the status on screen, the customer does not need to tap pay again to find out whether they paid.
Four questions for whoever runs your system
You do not need to know how the order number is created or where it is stored. You need to know whether someone has thought about it. These questions work for your team or for the company you hired:
- If the payment provider's response does not come back, does our system try again? Good answer: yes, on its own.
- When it tries, does it send the same order number as the first time, and does our payment provider accept that number? Good answer: yes to both, and what we recommend is that the number is created when the customer opens the payment screen.
- What does the customer see while waiting? Good answer: the button locks and the screen says the payment is being processed.
- If a charge still gets duplicated, how do we find out and undo it? Good answer: a report compares orders and charges, and the refund goes out the same day.
If your company has yet to choose who will process payments, the article on how to choose a payment provider for your app lists what to watch for in that choice, including attempts to pay twice.
Sources: Brandur Leach, "Designing robust and predictable APIs with idempotency", Stripe engineering blog, February 22, 2017; Malcolm Featonby, "Making retries safe with idempotent APIs", Amazon Builders' Library, undated page. Read on November 13, 2026.





