Engineering

The billing page must never lie

A billing page is a claim about money: who is paying, what they get, and when it ends. Most billing pages make that claim from a copy. The app keeps its own record of the customer's plan, copied from the payment provider at some earlier moment, and the page reads the copy. Copies drift. Ours drifted in three directions at once, and every direction was a different way for the page to lie to a member: a plan that existed only in our records, a customer link pointing at a record the provider had never heard of, and free-months codes that anyone who learned them could spend. This post is the architecture we shipped in November 2026 so the page can only say what the provider says, and the positions we took along the way. We think they apply to any small team building on a payments platform, which is most small teams now.

BravoDM Team · November 25, 2026

Cover for the BravoDM engineering post: the billing page must never lie. Two cards contrast our stored copy, which said Pro and was never checked, with the live source, which said Free with the upgrade path in the open.

The mirror every billing system keeps

Start with the machine, because the failure makes no sense without it. Like almost every SaaS, we kept a mirror. When a member subscribed, we stored her plan in our own database, along with the provider's identifiers for her customer record and her subscription. The billing page read the mirror. The feature gates read the mirror. Events arriving from the provider updated the mirror, most of the time, when they arrived in the order we expected.

A mirror feels like the responsible design. It is fast, it works when the provider is down, and it keeps the provider's API out of your page loads. It is also a claim you stop checking. The provider is the only system that actually moves the money, so the provider's state is the truth and yours is a copy of it, and copies drift. Ours had been aging since the beginning: our earliest billing records were written while billing ran in the provider's test mode, and when billing went live, stored links to test-mode records stayed in the database, pointing at customers the live account has never had. Nothing in the page ever asked the provider whether those links still resolved. We just believed them, every read, for weeks.

Our position, stated plainly because it drives everything below: never trust a stored copy over the live source. A mirror of billing state is a cache, and a cache of someone's plan is a liability whose expiry you do not control. If a page tells a member what she has, the page should ask the system that knows.

Three ways our copy drifted

The evidence, compressed. We audited what our billing surface believed against what the provider believed, and the disagreement came in exactly three shapes.

First, a plan that existed only in the mirror. We checked every stored customer link in our database against the live account. All but one resolved. The one that did not had been failing the same opaque way on every billing action for as long as it had been dead: the member saw a generic message that billing could not be opened just now, and underneath, the provider was answering that the customer did not exist. Every billing action that member tried hit the same wall and reported the same shrug. The plan on the page, meanwhile, read Pro, because the mirror said so.

Second, a member state with no honest name. A creator who held Pro through a free-months grant was Pro, but she was not a paying customer. The billing page offered her a portal for managing a subscription she does not pay for, and offered her no way to become a paying member from the billing page at all. Her state was real, common, and completely unrepresented: the page had vocabulary for paying and for free, and nothing for the person in between.

Third, personal codes that anyone could spend. A grant addressed to one person, a launch promo claim, a bank of referral months: each was a string in our database. Whoever learned the string could redeem it, and the rightful owner's months would be marked spent. There was no owner check anywhere, not ours and not the provider's, because we had never asked the provider to keep one. We had treated codes as marketing rather than as the credentials they are.

The live answer

The rebuild starts from the position above and follows it without exceptions. Every billing surface now classifies the member's access from live sources on every read, and the diagram below is the whole of it.

1Billing surfaces: page, pricing banner, portal route

The billing page, the pricing banner, and the portal route all begin with the same question: what does this member actually have, right now?

2Live classification: payment provider and grant ledger

The stored subscription is re-read from the payment provider, and the grant ledger is checked for a free-months window still open. The answer is computed, never remembered.

3Classification: Paid, Promo, or Free

Paid. Pro from a promo, with the exact date it runs to and the way up stated in the open. Or Free. Every surface speaks it, so the page and the product cannot disagree.

4Write-back to the stored record

The classification is written back to the stored record on the same read. A provider read that fails writes nothing: an outage can never downgrade a paying member.

HealStale customer link repair (billing actions only)

When a billing action learns that a stored customer link points at a record the provider no longer has: clear it, find or create the live customer, retry exactly once. Reads classify around a dead link. Only an attempted action rewrites it.

5Member-facing answer

And the next read starts from the truth, because the truth is what got written down.

How a billing read works now: classify from the live source, answer in plain words, write the truth back, and heal a dead customer link only when a member acts.

Walk it through. A read begins by re-reading the stored subscription from the provider and checking the grant ledger for a free-months window still open. Out of that comes one classification, stated to the member in plain words: Paid; or Pro from a promo, with the exact date her Pro runs to, the fact that nothing is charged, and the upgrade path stated in the open; or Free, with the same upgrade path. The billing page, the banner on the pricing page, and the portal route all speak this one answer, and the portal route now answers with the reason instead of a shrug: this member is on a promo, this one is Free, this link was dead. Then, on the same read, the classification is written back to the stored record, so the feature gates and the page are reading the same truth an hour later. The mirror still exists. It is just no longer allowed to originate anything.

Two details carry the design. The first is what happens when the provider cannot be read: nothing is written. A failed read shows the recorded plan and says the details are unavailable, because a provider outage must never downgrade a paying member. The classification moves a member to Free only when the provider affirmatively says the subscription is gone or finished, never when it merely fails to answer. The second is the promo upgrade, because the in-between state deserved a real exit. When a promo member chooses to pay, her remaining free months survive the decision: the paid plan is set to begin on the day the promo would have ended, her card is saved, and nothing is charged until then. Close to the end of a promo, billing starts today instead, and the page says so before she commits. Doing nothing stays honest too: her Pro ends on the stated date and she returns to Free, exactly as the page promised.

The dead link gets its own mechanism, the dashed box in the diagram, because classification alone only routes around it. The heal lives in the one shared path every billing action passes through, not in a cleanup script someone has to remember to run. When an action gets back the provider's answer that the customer does not exist, the stored link is cleared, the live customer is found from the identifiers we trust or created fresh, and the action retries exactly once. One detail of that retry is worth copying: the retry turns over its idempotency key. A rejected key replays its original error, so retrying under the same key fails the same way forever, and a heal that retries wrong is just a more expensive wall. Reads never trigger the heal. A member browsing her billing page classifies around a dead link and sees the truth; the link itself is rewritten only when she actually tries to do something, which is the moment the truth matters and the moment the system has her live details to resolve against.

Codes are a security surface

The third drift took the longest to fix properly, because the first fix was the wrong layer. The position we landed on: a code that anyone can type is a code that everyone owns. If a code is addressed to one person, its ownership has to be enforced by the platform that redeems it, not by our server's good intentions.

So every personal code is now issued by the provider as a promotion code restricted to its owner's customer. If she has no customer record yet, the code sits inactive until she does. Opening the billing page or starting checkout binds her open codes to her customer, re-issuing them in restricted form, because the provider cannot attach a customer to a code that already exists. And because the older codes were minted unrestricted, every server process runs a sweep when it boots that re-issues anything still open, so no unrestricted personal code survives a deploy. Shareable marketing codes, the kind meant to be typed by strangers, are created in the provider's dashboard, where that job belongs.

We did not go straight there. In the same stretch of work we first built our own code box on the billing page, with our own owner check and our own rate limit on guesses, because typing a code into the provider's checkout felt like a detour. Then we read what the platform already does. The provider restricts a promotion code to one customer natively, shows the member exactly what the code does on its own hosted page, and enforces ownership at the point of redemption, where our check could be routed around. So we deleted the box, the check, and the rate limit, and let the platform enforce it. The billing test suite that guards this whole path now runs more than 200 cases, and a good share of them exist to prove the deletion changed nothing for the member. The deletion was the best engineering in the sequence.

What we would tell any team building on a payments platform

These are positions, not tips. We hold them because the evidence above cost us a billing page that lied, and we think they generalize to anyone whose product takes money through someone else's platform.

  • Billing truth is a product feature. A billing page that can be wrong is not a data problem to clean up later; it is a defect in the product, on the page your customers trust most. Budget for it the way you budget for the checkout itself.
  • Never trust a stored copy over the live source. Keep the mirror for speed if you must, but let it originate nothing. Classify from the source on every read, write the truth back, and make a failed read fail toward the customer, never against her.
  • Personal codes are a security surface. The day you mint a code addressed to one person, you have issued a credential. Bind it to that person at the platform, keep it inactive until she can hold it, and sweep for the unrestricted ones you minted before you knew better; every team that has issued personal codes has some.
  • Do not rebuild what the platform already enforces. Platform features feel generic right up until you compare them honestly with your hand-rolled version, at which point yours is the generic one, with worse enforcement. Build the thing the platform cannot do for you. Delete the rest, and let the test suite prove the deletion was free.

Where these numbers come from

This post rests on the records of the billing work that shipped on November 23 and 24, 2026: the live classification and the promo upgrade path, the self-heal for stale customer links, and the move of personal codes to provider-enforced ownership, each verified by the billing test suite and live in production. The audit result stated above, every stored customer link checked against the live account with all but one resolving, is from that same pass. Figures the records could not verify are not stated here.

A note on how BravoDM runs

BravoDM is an agent-native company. A team of AI agents does the day-to-day work of building, operating, and writing about the product, with very little human involvement in the daily operations. The decisions are made by humans: what gets built, what ships, and judgment calls like the ones in this post are a person's, not an agent's. This article was drafted by the agent team from the records cited above, and it publishes with the founder's approval, like everything else we ship.