Latest / The CTO Podcast with Fexingo: Technical Leadership, Architecture, and Engineering Org / How Stripe Built a Payment Infrastructure for 100 Countries
Transcript
- Lucas: Stripe processes payments in over 100 countries now. That's not just a business milestone — it's a terrifying architectural problem. Luna: Terrifying because every country has its own banking systems, currencies, compliance rules? Lucas: Exactly. And the thing that makes Stripe's story interesting is how they rebuilt their core payments engine to handle that heterogeneity without turning into a mess of country-specific spaghetti code. Luna: Right, because the original Stripe was built for — what, maybe a dozen countries? The US, UK, Canada, a few more. Then suddenly they're adding India, Brazil, Nigeria. Lucas: Yeah. And each of those markets has local payment methods that are more popular than credit cards. In India it's UPI. In Brazil it's Pix. In Nigeria it's bank transfers. So Stripe's old model — where you have a single payment method type, 'card', and a single routing path — breaks completely. Luna: So what did they do? Did they create a separate integration for each country? Lucas: They did the opposite. They built a unified API that abstracts away all the local complexity. A developer calls the same Stripe API endpoint for a payment, and Stripe's engine decides — based on the customer's location, the currency, the merchant's preferences — which local payment method to use and how to route it. Luna: That sounds elegant from the developer's perspective, but the backend must be a nightmare. How do you handle all the different compliance requirements? Lucas: This is where it gets interesting. Stripe's architecture separates the payment processing logic into two layers. A global routing layer that's centralized and handles things like fraud detection, currency conversion, and idempotency. And then a local processing layer that runs in-region and deals with the specifics of each country's banking network. Luna: So the local layer talks directly to, say, India's UPI system or Brazil's Central Bank. Lucas: Exactly. And those local services are owned by small teams — usually two to four engineers — who become domain experts for that country. They're responsible for the integration, the compliance updates, and the reliability of that specific payment rail. Luna: That's a pretty flat structure. You're essentially saying Stripe has dozens of these tiny teams, each running a country-specific service. Lucas: Yeah. And they ship changes independently. If Brazil's Central Bank changes Pix's format — which happens — that team deploys an update without touching anything in the US or Europe. The global routing layer just sees a different response format. Luna: But doesn't that create consistency problems? If each team builds their service differently, you'd end up with a bunch of snowflake systems. Lucas: They solve that with a shared platform. Stripe built an internal framework called 'Payment Method Interface' that each local service implements. It defines the contracts for authorization, capture, refund, and reconciliation. Every local service follows that contract, so the global layer doesn't care about the implementation details. Luna: So it's like a plugin architecture. Each country is a plugin. Lucas: Exactly. And the global routing layer can treat every payment method as the same abstract object. It really simplifies the core logic. Luna: I want to talk about latency. When you add more countries, especially far from Stripe's main data centers, payment confirmation times can blow up. How did they handle that? Lucas: They built an edge-caching layer that stores payment method metadata close to the user. Things like 'what payment methods are available in this country', 'what's the current exchange rate', and even 'is this card likely to be declined'. That data is cached in Stripe's Points of Presence — they've got POPs in over 30 locations now. Luna: So the initial request doesn't need to hit the core payment engine every time. Lucas: Right. For a checkout page, the list of available methods comes from the edge. That cut latency by something like 4x in markets like Southeast Asia and Africa. The actual payment still goes through the full flow, but the user sees the options instantly. Luna: And what about currency conversion? Does Stripe do that in the global layer or local? Lucas: Global layer. They have a currency conversion engine that's separate from the payment routing. It uses real-time rates from multiple providers and adds a small margin. The interesting part is how they handle rounding — because different currencies have different decimal places, and if you're not careful, you end up with penny mismatches that break reconciliation. Luna: Penny mismatches sound tiny, but at Stripe's scale — they process hundreds of billions — those pennies add up. Lucas: Absolutely. And they affect merchants' books. So Stripe's reconciliation system has to handle that at scale, matching each transaction across multiple currencies and fees. That's a whole team dedicated just to that. Luna: You know, for a company that makes payments look simple, the engineering behind it is anything but. And that's why we spend time on these deep dives. Lucas: Yeah. And if these conversations are useful for what you're building or running, I'll mention something we don't talk about much. This show doesn't have ads. No sponsor reads, no affiliate links. That's a deliberate choice. Luna: It keeps the conversation clean. If you appreciate that, the simplest way to support it is buy me a coffee dot com slash fexingo. That's it. No tiers, no perks, just knowing the show stays ad-free. Lucas: Exactly. And it goes right back into production. So, back to Stripe's architecture — one more thing I found fascinating is how they handle fraud across all these countries. Luna: Oh, that must be wildly different per market. In the US, fraud patterns are mostly stolen cards. In Europe, it's often chargeback abuse. In Asia, it's account takeover. Lucas: Right. So Stripe's fraud engine — called Radar — uses machine learning models that are trained on global data but can be fine-tuned per country. They have a base model that sees all transactions, and then country-specific models that learn local patterns. Luna: Does that mean each country has its own fraud model running in production? Lucas: Not exactly. They use a multi-task learning approach where a shared neural network has country-specific output layers. So the model is one network, but it can output different fraud scores for different countries based on the same input features. That keeps the model size manageable. Luna: That's clever. And I imagine it updates frequently as fraud patterns shift. Lucas: Yeah, they retrain every few hours. And they have a feedback loop where if a transaction is later disputed, that signal goes back into the model. It's a pretty tight cycle. Luna: So the whole payments infrastructure is this layered system — edge caching, unified API, local processing, global routing, fraud models per country. It's remarkable that they manage it all without the complexity spiraling. Lucas: The key is that separation of concerns. The local teams own the complexity of their market, but they do it within a framework that the platform team provides. That lets Stripe add new countries in weeks instead of months. Luna: Do you think that model scales infinitely? What happens if they add 50 more countries? Lucas: That's the open question. The platform team has to maintain the interface, and as more countries are added, the interface might need to evolve. But so far, it's held up well. They've been adding about 10 countries a year. Luna: And the local teams — how do they avoid burnout? Being the sole expert for a country's payments sounds intense. Lucas: They rotate. Engineers move between country teams every year or so. That spreads the knowledge and prevents silos. Also, there's a central documentation hub where each team writes runbooks and decision logs, so no single person is a bottleneck. Luna: That's a good practice. Alright, I think we've covered the core architecture. Any final thought on what Stripe does well here that other companies often miss? Lucas: I'd say it's their willingness to accept that every country is different, but not letting that difference fracture the product. They invest in the abstraction layer — the unified API — and they enforce it strictly. A lot of companies either try to force a one-size-fits-all solution that fails in local markets, or they go fully decentralized and lose consistency. Stripe found a middle ground. Luna: And that middle ground is what makes them work in 100 countries. Great conversation. Lucas: Yeah. Thanks for listening.