Skip to content
All writing

A member did what my app asked and paid for October twice

On October 14 a member of my gym sent us their October card statement. Two of the lines on it were the same amount, $82.91, on October 3 and again on October 12. Both were payments for October's membership. At that moment my software still had October down as unpaid, and Stripe was still trying to charge their card for it.

The member had not made a mistake. They had done exactly what my app told them to do, twice, and my app had charged them for doing it.

Persistence Athletics is my gym in Seattle. It runs on a platform I built to replace the gym software we used to rent, with Stripe holding the cards and my own database deciding who owes what. This is the story of a seam between those two. I put it there, and it cost a member $82.91 and eleven days of being told they had not paid.

What the member saw

Their monthly renewal ran at 1:00am on October 3 and the bank declined it. The previous four renewals, June to September, had all gone through on the first try.

Seconds later the app posted a notice in their inbox: "Your payment of $82.91 was declined. Please update your payment method." They opened it. At 3:02pm that afternoon they went to the billing page, tapped Pay Now on the unpaid invoice, and paid $82.91.

Stripe tried the original invoice again at 7:00pm on October 10. Declined again. A second identical notice appeared. Just after midnight on October 12 they went back and paid $82.91 again.

The note I added to the repository on October 14 records a third attempt on that invoice scheduled for October 16. Had the card cleared on that one, they would have paid for October three times.

Meanwhile the app carried on as if nothing was wrong, because as far as it could tell nothing was. In those eleven days it sent the member two weekly recaps, the second one reading "Your last 7 days: 4 classes, 3 PRs, 6,200 lbs moved", and three reminders to book a body composition scan. Their membership never changed state. They kept training.

Why the button did that

An unpaid invoice in Stripe can be paid in two ways that look identical to the person paying. You can pay the invoice itself, on a page Stripe hosts for exactly that purpose. Or you can create a fresh checkout for the same amount, built from the same line items, which takes the same money from the same card.

My Pay Now button did the second. The money arrived as a standalone payment attached to nothing. The invoice stayed open, so Stripe kept retrying it on its own schedule, and my database, which takes its cue from the invoice, kept saying unpaid. The webhook that hears about completed checkouts had no branch for this kind, so the payment was filed nowhere.

old: Pay Now collects the amount owed as a new payment, and the bill stays open
new: Pay Now opens the bill itself, and paying it closes it

The button had worked this way since April 16. A declined renewal can also be paid by Stripe's own retry or by the member adding a new card, and both of those pay the invoice itself. Pay Now was only a problem for members who used it, which is to say the ones trying hardest to pay.

Who was told, and why nobody acted

On the first decline my team got a line in a shared notification channel. It said the charge had been declined, that Stripe would retry automatically, and to follow up if it stayed unpaid.

Nobody followed up, and I do not count that as anyone's failure but mine. "Follow up if it stays unpaid" is an instruction with no owner and no deadline, and "stays unpaid" was never going to resolve itself, because the member had already paid. The alert fired. It asked a question nobody was assigned to answer.

Neither notice reached the member's phone. Phone notifications had only shipped on October 12, and until October 14 they went to staff only.

The second member

The first thing I built after this was a way to read Stripe from the server, and the first thing I asked it was whether this had happened to anyone else. Stripe keeps 30 days of event history, so that is the window. In those 30 days the Pay Now button was used three times, by two members. Both paid twice.

The second case is the one that worries me more, because the step that sealed it was a careful one.

On September 30 at 1:00am a member's first-week charge of $76.28 declined. So did a second invoice for the same week, which should never have existed: a weekly billing job had opened a duplicate. Four minutes later the member tapped Pay Now on the duplicate and paid it, as a side payment. That morning an AI coding session fixing the duplicate-invoice bug found the duplicate, confirmed with Stripe that it was still open, and voided it. Stripe was right that it was open. The member's money was attached to nothing. On October 3 Stripe's retry collected the original invoice, and the member had paid for their first week twice.

The cleanup script asked exactly the right question before it acted. It asked the system that was wrong.

What I changed

Pay Now now opens Stripe's own hosted page for that invoice, so paying it closes it. Any old checkout that still completes is settled against its invoice automatically, with no further charge.

A declined renewal now goes through one path. The member gets an in-app notice, an email, a daytime text and a phone notification, all telling them to update their card and then tap Pay Now. I get a notification too. On the second decline, or after three days, booking goes on hold until it is paid, and classes they had booked from that day on are released. Reminders follow at day 7 and day 14, and on day 21 it comes to the team. Nothing cancels a membership automatically, and saving a card no longer charges anything.

Neither member was refunded. Both got a credit for the full amount against their next renewal, which was my call. The second member's applied on October 18, when a renewal that would have cost $87.33 cost them $11.05. The first member's November 3 renewal is due to come to zero.

The review that arrived four hours late

The multi-agent adversarial review I wanted on this change stalled when my session hit a usage limit, so I checked the change by hand and deployed it before noon. The review ran properly that afternoon, against code that was already live, and came back with 17 confirmed findings.

Most were the kind of thing billing code accumulates: a late payment that would never queue the following month's charge, a decline counter that never reset, texts that could go out twice. One was serious. The first version charged every open invoice on a member's account the moment they saved a new card, which would have included renewals on memberships they had stopped and one-off charges a coach had raised. I ruled that saving a card should save the card and nothing else, and the fixes were live by 3:45pm.

In those four hours the only invoice marked paid was the first member's, which I settled against the money they had already sent, with no new charge. Nobody was charged by the card-save path. That is not evidence the process worked. It is a quiet Wednesday afternoon.

What this does not prove

This is two members and $159.19. Both were credited the same day the gym found out, and the amounts are small.

More importantly, I cannot tell you they were the only two. The button existed from April 16. Since then 19 declined-payment notices have gone to six members. Three of those members, and 14 of those notices, fall before anything I can audit. Stripe's event history covers 30 days. The server's logs begin on September 30. The other scan I built, which looks for orphan payments against invoices that are still open or voided, would not find the first member's case today, because that invoice is now paid. Somebody may have paid twice between May and August and never noticed. I do not know.

The new escalation has never fired. Since it went live, 24 renewals have been paid and none has declined. It is tested code, not a tested process, and I will not know how it behaves until a real card fails.

I also do not know whether the first member would ever have found out without reading their own statement. My software was not going to tell them.

The strongest case against me

The best objection is that this is simply the price of building your own billing. Stripe already hosts a page that pays an invoice correctly, and already sends its own failed-payment emails. A gym renting off-the-shelf software would never have met this bug, and the fix was to use the page that had been there all along.

That is fair, and I would not tell most small businesses to own their billing. What owning it bought me is that I could see the problem, query it and fix it inside a day, and that a scan for other victims exists at all. What it costs is that every seam between my records and the processor's is mine, and a seam does not announce itself. It waits for a customer to do the right thing.

The second objection is that $159.19, credited within a day, is not worth this many words. The cost was never the dollars. It was a member doing exactly what they were asked, twice, and being charged for it, while every alert fired as designed and nobody acted.

What generalises

Test a pay button by what happens after it, not by whether money arrives. If the screen that said unpaid still says unpaid after a successful payment, the button collected an amount rather than settling a debt.

A failed payment is a customer conversation, not a log line. An alert that says to follow up if something stays unpaid needs a named owner and a date, or it will be read, agreed with and left.

And when a cleanup step checks whether something is still unpaid before it acts, ask which system it is checking. It may be the one that is wrong.

If your customer-facing payments and your own records can disagree without anyone noticing, finding those seams is the kind of work Autosterea does.

First published on ravikantdewangan.com.

Tell us what eats your week.

A free 20-minute call. We'll show you what we would take off your plate.

Book a call