Skip to content
All blogs

What Happens After You Press Pay

7 min read

Pressing Pay takes one second. Most of the trouble starts after that.

I have worked with payments long enough to see the same few problems come back again and again. None of them are hard to understand. But they are easy to forget when you are busy. And with money, forgetting costs real people real money.

So here are the five lessons I keep coming back to. Each one comes with a simple example.

One click to pay, and five things that can still go wrong after it
One click to pay. Five things that can still go wrong after it.

1. Sometimes you ask, sometimes you wait to be told

Think about ordering food.

If you call the restaurant and say, "Is my food ready?" you are asking. You get an answer right away.

If the restaurant calls you when the food is ready, you are being told.

Payments work both ways.

When I want to give a customer their money back, I ask. I send the request, and I get a reply.

But many things happen on someone else's clock. A customer's bank may question a charge three days later. A monthly payment may fail at 2 at night. I cannot guess when these will happen. So I wait for them to tell me.

Some people try to keep asking instead. "Is it done? Is it done?" If you ask every 5 seconds for 10 minutes, that is 120 questions. Almost all of them get the same answer: not yet. And if the customer closes the page halfway, you may never find out what happened.

My rule is simple. If I start it, I ask. If someone else starts it, I wait to be told.

Many things are a mix of both. A refund starts when I ask for it. But the money can take several days to reach the customer's card. So the final "done" comes later, when they tell me.

2. Things arrive in the wrong order

Say you post three letters to a friend—one on Monday, one on Tuesday, one on Wednesday. Nothing stops the Wednesday letter from arriving first.

Payment updates work the same way. One single payment can send twenty or more small updates. Customer created. Card added. Bill made. Bill paid. Payment done. They do not always arrive in that order. I have seen "payment done" arrive before "payment started". I have also seen one update show up long after everything else, when I thought it was all over.

Here is why that matters. Say the "paid" update comes first, and you mark the order as paid. Then the "started" update arrives late, and your system changes the order back to "waiting for payment". Now a customer who already paid gets a payment reminder. They are confused, and they write to support.

So I never build anything that expects "first this, then that". If a late update is older than what I already know, I ignore it. A paid order should never go back to waiting.

3. The same thing will happen twice

Think about a lift button. Press it once or press it five times, and the lift still comes once. Payments should behave like that.

Here is what happens when they do not.

A customer pays 30 dollars for a plan. The money leaves their account. But on the way back, the internet drops for a second, and the reply gets lost. The system thinks the payment failed, so it tries again. Now the customer has paid 60 dollars for one plan.

Repeats happen in many other ways too. A customer taps Pay twice because the page feels slow. Someone refreshes the page. The payment company sends the same update twice, just to make sure you got it.

You cannot stop repeats. You can only make them harmless.

My approach is simple. Every action gets its own fixed number, like a receipt number. Before doing anything, I check one thing: have I seen this number before? If yes, I do nothing and just say, "already done."

Here is an example. Update number 123 says, "This customer paid; give them one more month." If it arrives twice and I act on both, the customer pays for one month and gets two. With the receipt number check, the second copy is ignored, and the customer gets exactly one month.

4. Keep the money the way it was paid

A customer in Germany pays 1,000 euros. Someone on the team says, "Let's keep everything in dollars. It makes reports easier." That day, 1 euro is 1.10 dollars. So the record now says 1,100 dollars. The 1,000 euros is no longer written anywhere.

A month later, the customer asks for a refund. Now 1 euro is exactly 1 dollar. So 1,100 dollars becomes 1,100 euros. You just paid back 100 euros more than you received.

Now flip it. Say 1 euro becomes 1.25 dollars. Then 1,100 dollars becomes only 880 euros. The customer gets back 120 euros less than they paid. Their bank statement says 1,000 euros. Yours says something else. Now you have an angry customer and mismatched numbers.

(I picked round numbers here just to make the math easy.)

What I do is boring, and it works. I save the money exactly as it was paid. 1,000 euros stays 1,000 euros, forever.

If I need dollars for a report, I write it down as a separate note: 1,000 euros became 1,100 dollars at a rate of 1.10 on 12 October, using the bank's rate. The refund always uses the original 1,000 euros. The note is for the report only.

5. Do it all, or do nothing

Think about moving house. You would not hand back your old keys before you have the new ones. If the new place falls through, you are standing on the street.

Changing a price works the same way. Say a plan costs 30 dollars and you want to make it 35. That takes two steps. First, turn off the old price. Second, add the new price.

Now say step one works and step two fails. The old price is off. The new price never showed up. The plan simply disappears from the shop, and nobody can buy it until someone notices.

The fix is to tie the steps together, so that either both happen or neither does. If step two fails, step one is undone automatically, and the old price stays live. Customers never notice anything.

There is one trap here. Make sure every step is really inside that group. If even one step slips outside, it finishes on its own, and you are back to the same broken shop.

The short version

  1. Ask when you start it. Wait to be told when someone else starts it.
  2. Expect updates to arrive late and out of order.
  3. Let twice count as once.
  4. Keep the money the way it was paid.
  5. Do related steps all together, or not at all.

None of these are clever ideas. They're easy to skip when a deadline is close. But a small mistake on our side is real money on the other side. 100 extra euros paid out. A customer charged twice. A plan nobody can buy for a whole afternoon. That is why I go through this list every single time.

Jahid Hiron
Software Engineer @ ChartVPS Technologies · Udemy instructor
Work with me

Newsletter

Get the next article

Practical notes on billing and payment gateways.

No spam. Unsubscribe anytime.