Most billing bugs aren't about the invoice math. They're about having two code paths that both think they're responsible for charging the customer.
We just shipped a fix for exactly that in DymCore, our invoicing and billing platform for small businesses. The commit message says it plainly: "lo que se ve es lo que se cobra" — what you see on screen should be what gets charged, no more, no less.
DymCore lets businesses add paid modules on top of their base plan. Module purchases touch two places in the codebase: a module-billing service that handles the module's own lifecycle, and the store/billing service that aggregates everything into what the customer actually pays. When both paths compute a charge for the same module instead of agreeing on a single total, the business ends up billed twice for one thing.
The fix consolidates that logic into one place: a new consolidated-billing.ts module that becomes the single source of truth for what a combination of modules should cost. billing.service.ts, module-billing.service.ts and store.service.ts were all updated to go through it instead of calculating their own partial totals.
We also added a dedicated spec file, cobro-consolidado.spec.ts, with 111 lines of tests just for the consolidated path, covering module combinations that previously had no coverage at all. The billing dashboard on the frontend was updated too, so what the business owner sees on the page matches what the consolidated service actually charges.
None of this is glamorous work. It never shows up in a changelog a user reads, but it's the difference between a business trusting its invoice or opening a support ticket. If you're building anything with modular pricing, it's worth asking early: is there exactly one place in your code that decides what a customer pays, or did that logic quietly grow in two places at once?
DymCore is an invoicing and billing platform built for small businesses in Ecuador and Latin America, including SRI-compliant electronic invoicing. More at dymcore.com.
Backend
Source:https://dev.to/jdevleon/what-you-see-is-what-gets-charged-fixing-a-double-billing-bug-in-a-modular-saas-1m2i
What You See Is What Gets Charged: Fixing a Double-Billing Bug in a Modular SaaS
dev.to WebDev0 views
PreviousGoogle Ads clicks but no conversionsNextI can build the product with AI. Getting the first users is harder.
Related posts
Fingerprint enables rapid regulatory compliance with Elastic
0Elastic Blog
Solo.io's Agent Substrate Goes GA: Production Runtimes for AI Agents
0dev.to AI
AWS Tagging Strategy: Name, Owner and Environment Tags for Every Resource
0dev.to AWS
Understanding Infrastructure as a Service (IaaS): A Practical Case Study of Amazon EC2 Introduction
0dev.to AWS
Vibe code cleanup: how to know the cleanup did not break your AI-built app
0dev.to WebDev
The Social-Card Layer of Our Own 56 Pages: One Preview Image, 56 Titles, and 10 Pairs That Share a Description
0dev.to WebDev