Billing Engine
A provider-agnostic payments and billing engine handling charges, subscriptions, splits and automated Brazilian tax invoices across Asaas, Stripe and Starkbank.
- Stripe
- Asaas
- Starkbank
- Node.js
- PostgreSQL
- Prisma
- TypeScript

Challenge
Products across billing, fintech and ISP verticals each needed payments, but no single provider covered every case — and tying business logic to one gateway meant rewrites whenever pricing, region or provider changed. On top of that, Brazilian tax compliance (NFS-e / NF-e) had to be automated, not manual.
Solution
I designed a provider-agnostic abstraction layer that models charges, subscriptions and splits independently of any gateway, with adapters for Asaas, Stripe and Starkbank behind one interface. Automated tax-invoice emission is wired through Plugnotas and FocusNFe, and webhooks reconcile provider state back into a single source of truth.
Overview
The billing engine is the payments backbone shared by several multi-tenant SaaS products. It decouples what is being charged from how it’s charged, so a product can switch or combine providers without touching business logic.
Design
- Provider-agnostic core — charges, subscriptions and splits are modeled as domain entities. Gateways (Asaas, Stripe, Starkbank) are adapters implementing a shared contract.
- Tax automation — invoice emission (NFS-e / NF-e) runs through Plugnotas and FocusNFe, triggered by payment lifecycle events.
- Reconciliation — provider webhooks feed a state machine that keeps the internal ledger consistent, with idempotency to survive retries and duplicate events.
Why it matters
Payments are where correctness is non-negotiable. The engine’s value is in the boring guarantees — idempotency, reconciliation, and a single source of truth — that let every product on top treat billing as solved.
Impact
- One billing domain, three swappable payment providers
- Charges, subscriptions and payment splits out of the box
- Automated NFS-e / NF-e emission via Plugnotas and FocusNFe
- Webhook-driven reconciliation into a single source of truth
- Reused across multiple SaaS products and verticals
More work

AI Copilot
A multi-agent AI copilot embedded across web and WhatsApp — GPT-4o, Claude and Groq with RAG, function calling and real-time streaming.

WhatsApp Automation
Transactional notifications, cadence engines and conversational scheduling over the WhatsApp Business API — cutting manual follow-ups by 80%+.