Quick revision
The short answer
I would build a core payments platform: an orchestration service with one common state machine, provider adapters behind a single interface, routing rules and a shared ledger. Country teams add local payment methods as adapters and configuration rather than separate stacks, and the platform provides idempotency, reconciliation, fraud hooks, tokenisation to reduce PCI scope, audit trails and strong event contracts for orders and finance. Migration goes country by country with shadow traffic and reconciliation of both paths before cutover, and the design allows local storage and processing where data residency requires it.
What to remember
In this answer, we designed a payments platform with a common orchestration state machine, provider adapters behind one interface, routing rules and a shared ledger. Country teams extend it with adapters and configuration instead of separate stacks, and the platform supplies idempotency, reconciliation, fraud hooks, tokenisation for PCI scope, audit trails and versioned events. We planned for data residency with regional deployments and migrated country by country with shadow traffic and reconciliation of both paths before cutover.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would build a core payments platform: an orchestration service with one common state machine, provider adapters behind a single interface, routing rules and a shared ledger. Country teams add local payment methods as adapters and configuration rather than separate stacks, and the platform provides idempotency, reconciliation, fraud hooks, tokenisation to reduce PCI scope, audit trails and strong event contracts for orders and finance. Migration goes country by country with shadow traffic and reconciliation of both paths before cutover, and the design allows local storage and processing where data residency requires it.
Why this question is asked
When twelve country teams each build their own payment integration, the company pays for the same hard problems twelve times: idempotency, reconciliation, PCI compliance, provider outages. Each integration has its own bugs, finance receives twelve different data formats, and adding a provider or a global feature such as a new fraud check takes twelve projects. Interviewers ask this question to see how an architect designs a platform that others build on and how to move live payment traffic onto it without risk. In this answer, we will design the core platform, show how country teams extend it, list the shared capabilities, define the contracts for downstream consumers, handle data residency, and plan the migration.
1The Core: Orchestration, Adapters, Routing and Ledger
Payment orchestration is the service that owns a payment's lifecycle: it receives the request, applies the state machine (created, authorised, captured, failed, refunded, unknown), chooses a provider, calls it, and records the outcome. Every country uses the same state machine, which is what makes behaviour, reporting and support consistent.
Providers sit behind one adapter interface: authorise, capture, refund, void, lookup and parse webhook. An adapter translates between the platform's model and one provider's API. Routing rules decide which provider handles a payment, based on country, payment method, currency, cost and the providers' current health. A shared double-entry ledger records every money movement, so finance has one source of truth across all 12 countries and 6 providers.
- Channels and order servicescheckout, apps, invoicing in 12 countries
- Payments APIidempotency, authentication, one contract
- Orchestrationcommon state machine, routing rules, fraud hooks
- Provider and method adapters6 providers, local methods as plug-ins
- Vault and tokenisationcard data isolated, PCI scope small
- Ledger, events and reconciliationone ledger, outbox events, daily matching
6 layers, from the top down. Step through them one at a time.
2How Country Teams Extend It
The platform must not become a bottleneck where every Brazilian or Dutch payment method waits for the central team. So extension points are explicit. A country team adds a local payment method, such as a bank transfer scheme or a wallet popular in one market, by writing an adapter against the published interface and its test kit, and by adding configuration: which countries and currencies it serves, its routing priority, its limits and its settlement format. The platform team reviews and certifies adapters but does not write all of them.
What country teams no longer build is everything around the adapter: the state machine, idempotency, retries, ledger postings, reconciliation, monitoring. That is where most of today's duplicated effort and most of the bugs live.
3Shared Capabilities
The platform provides once what every team needs. Idempotency: a unique key per request and the payment id as the provider key on retries. Reconciliation: one engine that reads all six settlement formats and feeds one exception queue. Fraud hooks: a pre-authorisation call to the fraud service, the same in every country, with country-specific rules as configuration. PCI scope reduction: card numbers are captured by provider-hosted fields or a central vault and replaced with tokens, so the orchestration service and country code never see raw card data, which keeps them out of the most demanding PCI DSS controls. Audit trails: every state change and every operator action recorded immutably.
4Contracts and Events for Downstream Consumers
Orders, finance, customer support and analytics all consume payment outcomes. Today each country emits something different. The platform publishes one set of versioned events, such as PaymentAuthorized, PaymentCaptured, PaymentFailed and RefundCompleted, through a transactional outbox to Kafka, with a schema registry enforcing compatible changes. Consumers learn one contract instead of twelve, and finance can build reporting once. A synchronous API contract, documented and versioned, covers the request side.
5Data Residency
Some countries require payment or personal data to be stored, and sometimes processed, within their borders. The design should not assume one global database. I would make the platform deployable per region, with the same code and configuration-driven routing, so a country with residency rules gets its own deployment and storage in-country, while only aggregated or permitted data flows to the global ledger and reporting. Legal and compliance review each country's rules before its migration, because discovering a residency requirement after cutover means moving live payment data.
6Migrating Country by Country
A big-bang switch of 12 countries is too risky for payments. I would migrate one country at a time, starting with a mid-size country using providers the platform already supports, to prove the approach without betting the largest market.
For each country, we first run shadow traffic: the existing integration keeps processing real payments, and the platform receives a copy of each request and runs it against provider sandboxes or in a dry-run mode, recording what it would have done. Comparing the two paths finds mapping and routing differences safely. Then we move a small share of real traffic, for example 5 percent, to the platform and reconcile both paths daily against the providers' settlement files. When the platform's exception rate is at or below the old path's for a few weeks, we increase to 100 percent, keep the old integration available for rollback for a period, and then retire it.
- Build or certify the country's adapterslocal methods as configuration
- Shadow trafficcompare platform decisions with the old path
- Move 5 percent of real paymentsreconcile both paths daily
- Exception rate at or below old path?for several weeksYesRamp to 100 percentNoFix and stay at 5 percent
- Retire the old integrationafter a rollback window
5 steps in order. Play them, or step through them one at a time.
7Follow-up questions
How do you stop the platform team from becoming a bottleneck?
By making extension self-service: a documented adapter interface, a test kit with provider simulators, configuration in a repository that country teams can change through reviewed pull requests, and clear certification criteria. The platform team owns the core and the standards and reviews adapters, but country teams build and run their local methods. Measuring the lead time for a new payment method tells us whether this is working.
What if one country's existing integration has features the platform lacks?
We list them during migration planning and decide for each one: build it into the platform if other countries will need it, implement it as an adapter or configuration if it is local, or retire it if nobody uses it. A country migrates only when its required features exist, which is another reason to start with a country whose needs are close to the core.
8Conclusion
In this answer, we designed a payments platform with a common orchestration state machine, provider adapters behind one interface, routing rules and a shared ledger. Country teams extend it with adapters and configuration instead of separate stacks, and the platform supplies idempotency, reconciliation, fraud hooks, tokenisation for PCI scope, audit trails and versioned events. We planned for data residency with regional deployments and migrated country by country with shadow traffic and reconciliation of both paths before cutover.
Open with
I would build a core platform that every country uses, with clear extension points so country teams are not blocked by a central team. The core is a payment orchestration service with one state machine, created, authorised, captured, failed, refunded and unknown, a routing layer that chooses among the six providers by country, method, cost and health, provider adapters behind one interface, and a shared double-entry ledger so finance has one source of truth.
Then, if they want more
Country teams add local payment methods as adapters plus configuration, using a published interface and a test kit, rather than building whole stacks.
What they no longer build is everything around the adapter: idempotency keys, retries and unknown-state resolution, reconciliation of all six settlement formats, fraud hooks, tokenisation so card data never touches most services and PCI scope stays small, and audit trails. Downstream, orders and finance get one set of versioned payment events through an outbox, instead of twelve formats.
I would plan for data residency from the start, so the platform can be deployed in-region for countries that need local storage or processing. For migration, I would go country by country, starting with a mid-size one.
First shadow traffic to compare decisions with the old integration, then a small share of real payments with both paths reconciled daily against settlement files, and only when the exception rate is at least as good do we ramp to 100 percent and retire the old code.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your company processes payments in 12 countries through 6 providers, and each country...": https://scrivio-interview-library.netlify.app/architecture/backend-system-design/7f20a8d50c/