1. The Day Our Customer Became a Company
For years, our credit card platform had one customer that mattered: the person holding the card. Every architecture decision assumed one brand, one app, one set of rules and one company paying the bills. Then the business changed direction. The same infrastructure would be offered to other companies, so they could launch and run their own card products on top of it.
Today the platform runs four clients on a shared environment, serving more than 200,000 cardholders and processing more than 500,000 transactions a day. Getting there wasn't about rewriting the platform. It was about answering, one by one, a set of questions that a single-brand system never had to ask.
This post covers the decisions that shaped that transformation, the trade-offs behind them, and the tools we used. Most of them apply to any platform moving from one brand to many.
2. What Actually Changes in B2B
The transactions look the same: a purchase, an authorization, an invoice, a payment. What changes is everything around them.
| Consumer platform (B2C) | B2B platform | |
|---|---|---|
| Who you serve | One brand, its cardholders | Several clients, each with its own cardholders |
| Business rules | One set, often in code | One set per client: fees, limits, billing cycles, collection rules |
| Data | One database, one owner | Each client's data must be isolated and provably so |
| Incidents | Affect your customers | Can affect every client at once, or one client because of another |
| Success metric | Cardholder experience | Cardholder experience and each client's contract (SLAs, reports, invoices) |
| New business | A marketing campaign | A pre-sales process, an integration project and an onboarding |
Each row became a decision. The rest of this post walks through them.
3. Decision 1: How Much Do Clients Share?
The first and most expensive decision is the tenancy model: how much infrastructure each client shares with the others. There are three classic options, and none of them is free.
| Model | What it means | Good at | Costs you |
|---|---|---|---|
| Silo | A full stack per client | Strong isolation, simple compliance story | Infrastructure and operations multiply with every client |
| Pool | Everything shared, data tagged by client | Lowest cost, fastest onboarding | Isolation depends on discipline in every query and every service |
| Bridge | Shared services, isolated data or critical parts | Balance of cost and isolation | More design work up front |
For a card platform, the bridge model is usually the right answer: share the compute, isolate
what is sensitive. Authorization, billing and collection services run once for everyone,
while cardholder data, credentials and client configuration are separated per client. It keeps the cost
of a new client low without making isolation depend on every developer remembering a
WHERE client_id = ?.
4. Decision 2: Every Request Knows Its Client
Once clients share services, the most important rule is simple: the client context travels with every request, every event and every log.
- Identity carries the client. Authentication (we use AWS Cognito) issues tokens that include which client the user or system belongs to. Services read the client from the token, never from a parameter the caller could change.
- Events carry the client. Every message on the queues (AWS SQS and SNS) has the client in its metadata, so asynchronous work can't lose track of whom it belongs to.
- Logs, metrics and traces carry the client. When something goes wrong, the first question is "which client?", and the answer has to be one filter away.
- Data access enforces the client. Isolation is checked in a shared data-access layer, not left to each query.
This is unglamorous work, and it is what makes everything else possible: per-client billing, per-client monitoring, per-client limits and per-client audits all depend on it.
5. Decision 3: Configuration, Not Code
In a single-brand platform, business rules tend to live in code. That stops working the moment a second
client wants a different billing cycle. If every client difference becomes an if in the
code, the fifth client turns the platform into a maze.
The answer is to treat each client's product as configuration: fees, interest rates, credit limits, billing cycles, due dates, notification templates, collection rules and the client's branding. New clients get a new configuration, not a new branch.
Our collections platform was built multi-tenant from day one. Each client defines its own collection flow, with segments by days overdue, amount and risk, and reminder steps over email, SMS and WhatsApp, as configuration on a shared engine. It processes 400,000+ records a day, and with its GraphQL API, onboarding a new partner went from weeks to days.
The rule I use: if two clients could reasonably want different values, it's configuration. If no client will ever want it different, it's code. When in doubt, ask in pre-sales: clients will tell you exactly what they need to change.
6. Decision 4: Design for the Peak, Not the Average
500,000 transactions a day sounds big. Divided by the seconds in a day, it's about six transactions per second. That average is almost useless, and it's the number that misleads teams most often.
Card traffic is not flat. It peaks at lunchtime, on paydays, on Friday nights and around shopping dates, and when several clients share a platform, their peaks add up. Card authorizations also have a hard time limit: the network expects an answer in a fraction of a second, every time.
That led to a few standard decisions:
- Keep the authorization path short and synchronous. Only what is needed to say yes or no runs while the cardholder waits.
- Move everything else to events. Notifications, ledger updates, reporting, fraud analytics and billing run asynchronously over queues (SQS and SNS), so a slow consumer never slows a purchase.
- Make every operation idempotent. Messages get delivered twice, networks retry and processors resend. Every transaction has a unique key, and processing it twice must give the same result as processing it once.
- Scale horizontally. Services run on Kubernetes and scale with load; the database choice follows the access pattern (relational where you need transactions, document stores where you need flexible, high-volume records).
7. Decision 5: One Client Can't Hurt the Others
Shared infrastructure brings a new kind of incident: the noisy neighbor. One client runs a big campaign, imports a large batch or has a bug in its integration, and every other client feels it.
The defenses are well known, and all of them depend on the client context from Decision 2:
- Rate limits and quotas per client on APIs and batch jobs.
- Separate queues or priorities for heavy, non-urgent work such as imports and reports, so they never compete with authorizations.
- Per-client alerts, so you see one client's traffic growing before it becomes everyone's problem.
- Agreed limits in the contract. Technical limits work better when the client already knows about them.
8. Decision 6: Security and Compliance as a Product Feature
In B2C, security protects your customers. In B2B, it is also part of what you sell. Every prospective client asks the same questions in pre-sales: how is our data separated, who can access it, and how can you prove it?
- Isolation you can demonstrate, not just describe: per-client encryption keys and access policies where the data is sensitive.
- Card data handled to card-industry standards (PCI DSS) and personal data handled under Brazil's data-protection law (LGPD).
- Security in the pipeline: security checks and SonarQube quality gates in GitLab CI, so no critical finding reaches production.
- The CISO in the architecture decisions, not just in the audit. On our platform, every major decision is reviewed by a committee that includes the CISO.
9. Decision 7: Observe Each Client Separately
A platform-wide dashboard that is green can hide one client having a terrible day. In B2B, averages lie in a new way: a 99.9% success rate overall can mean one client at 95%.
- Metrics, traces and dashboards per client with OpenTelemetry, Prometheus and Grafana.
- Errors and crashes per client with Sentry for services and Firebase Crashlytics for the mobile apps.
- Service-level objectives per client for what matters most: authorization success rate, latency and invoice generation on time.
- AI to connect the dots. We built an SRE agent that cross-checks Grafana, Sentry and Crashlytics through MCP servers, to flag customer-facing errors before cardholders complain to support.
10. How We Make These Decisions
None of the decisions above has a single right answer. Each one trades cost against isolation, speed against safety, or flexibility against simplicity. What matters is making those trade-offs explicitly, and being able to explain them a year later.
- C4 models describe the platform at every level, from the context a client sees to the components inside each service. They are the common language between engineering, security and the business.
- Every decision writes down its trade-off. What we chose, what we rejected and why.
- A review committee, with another architect, the CISO and two engineering managers, checks each major decision before it is final. It slows decisions down a little and stops many mistakes from reaching production.
- Pre-sales feeds the architecture. I join pre-sales meetings with prospective clients, and the most useful thing I do there is listen: understanding the client's position and real needs before proposing anything. Many of the configuration options above started as a question from a client.
11. The Toolbox
| Need | Tools |
|---|---|
| Services | Java (Quarkus), Node.js/TypeScript, Python for data pipelines |
| APIs for clients | REST and GraphQL |
| Events and messaging | AWS SQS and SNS |
| Identity | AWS Cognito |
| Data | PostgreSQL, MongoDB, DynamoDB, Redis |
| Runtime | AWS, Kubernetes, Docker |
| Quality and security | GitLab CI, SonarQube quality gates, TDD, Cypress, CodeRabbit |
| Observability | OpenTelemetry, Prometheus, Grafana, Sentry, Firebase Crashlytics |
| Architecture | C4 models, documented trade-offs, review committee |
The tools matter less than the decisions. Each of these could be swapped for an equivalent. Skipping the client context or the per-client monitoring can't be fixed with a better tool.
12. A Checklist Before Your Platform Goes B2B
- Have you chosen a tenancy model on purpose? Silo, pool or bridge, with the trade-off written down.
- Does every request, event and log carry the client? From the token, not from a parameter.
- Are client differences configuration? Fees, cycles, limits, rules and branding.
- Are you sized for the peak? All clients' peaks at once, load-tested.
- Can one client hurt the others? Rate limits, separate queues and per-client alerts.
- Can you prove isolation to a client's security team? Not just explain it.
- Can you see each client's health on its own? Per-client dashboards and SLOs.
- Are decisions reviewed and recorded? With security at the table.
13. Conclusion
Turning a credit card platform into a B2B product didn't need a new platform. It needed a new question at every layer: "for which client?". Once identity, events, data, configuration and monitoring could answer it, adding a client stopped being a project and started being an onboarding.
The hardest part wasn't technical. It was accepting that a B2B platform has two kinds of customers, the companies and their cardholders, and that both judge you every day. The architecture has to make it easy to keep both happy, and to know quickly when one of them isn't.
Share the compute. Isolate what's sensitive. And make sure every part of the system knows who it's working for.