A payment gateway looks like one product from the outside. Inside, it's a dozen services that each do one job: take the payment, protect the card number, decide where to send it, talk to the acquirer, check for fraud, and turn the result into money your merchant can see.
This page lays out a payment gateway architecture component by component, with a diagram of how a payment moves through it. It covers where card data should live, which parts fall inside PCI DSS scope, and the design choices that decide how well the whole thing holds up under load.
The components of a payment gateway
Every gateway has the same core pieces, whatever it's built with. The table lists them with the job each one does and whether it touches card data.
| Component | What it does | Touches card data? |
|---|---|---|
| Merchant API | Accepts payment requests from merchant servers (host-to-host) | Only if merchants send raw card numbers |
| Hosted payment page and SDKs | Collect card details in the browser or app, keeping them off merchant servers | Yes |
| Tokenization vault | Stores card numbers and returns tokens; holds network tokens from the schemes | Yes, the core of the cardholder data environment |
| Key management | Protects the encryption keys, often in hardware security modules | Yes, indirectly |
| Routing engine | Picks the acquirer or method for each payment and retries on failure | No, works on tokens and metadata |
| Acquirer and method connectors | Translate each payment into each provider's API format | Yes, for card payments |
| 3-D Secure Server or MPI | Runs cardholder authentication with the issuer | Yes |
| Fraud and risk engine | Scores each payment against rules and external scoring | Usually tokens and metadata |
| Merchant back office | Onboarding, pricing, settlements, reconciliation, chargebacks | No, if designed well |
| Reporting and webhooks | Statements, analytics and real-time event notifications | No |
| Admin, roles and audit trail | Controls who can see and change what, and records it | No |
| Monitoring and alerting | Watches every component and connector around the clock | No |
The column on the right is the one that shapes everything else. Only a few components need to see a card number, and keeping it that way is the single best architecture decision you can make.
Payment gateway architecture diagram
Here's the path of one card payment through the components above. Each arrow is a call between services, and the services on the top line form the cardholder data environment.
Shopper browser / app
|
v
[Hosted page or SDK] ----card number----> [Tokenization vault] <--> [Key management / HSM]
| |
token token
v v
[Merchant API] --> [Fraud and risk engine] --> [3-D Secure Server / MPI] <--> Card issuer
|
v
[Routing engine] --> [Connector A] --> Acquirer A
| \-> [Connector B] --> Acquirer B (fallback)
v
[Merchant back office: settlement, reconciliation, chargebacks]
|
v
[Reporting and webhooks] --> Merchant dashboard and systems
Card numbers flow only along the top line and through the connectors that send them to an acquirer. Everything below the routing engine works on tokens, amounts and statuses.
How a payment moves through the gateway
The diagram compresses a sequence that runs in a second or two. These are the steps in order.
- The shopper enters card details on the hosted page or in the SDK, and the card number goes straight to the vault.
- The vault returns a token, and the merchant's request continues with that token.
- The fraud engine scores the payment and either passes it, declines it or sends it to authentication.
- The 3-D Secure component authenticates the cardholder with the issuer when rules or regulation call for it.
- The routing engine picks the acquirer, and the connector sends the authorization request in that acquirer's format.
- If the acquirer declines for a reason another acquirer could approve, cascading retries on a second route in the same attempt.
- The result goes back to the merchant, a webhook fires, and the transaction joins the next settlement run.
Steps 3 and 6 are where architectures differ most. A gateway that screens and retries well turns more attempts into approved payments without any change on the merchant's side.
Where card data lives, and why it matters for PCI DSS
PCI DSS applies to every system that stores, processes or transmits cardholder data, and to everything connected to those systems. A flat architecture where every service can read card numbers pulls the whole platform into scope, and every audit gets longer and costlier.
The usual fix is segmentation. The vault, key management, the payment page and the card connectors sit in a separate network zone with strict access, and every other service receives only tokens. Segmentation is also something an assessor checks in a PCI DSS assessment, because it decides which systems are in scope.
E-payment gateway architecture versus mobile
An e-payment gateway architecture for websites and one for mobile apps share the same back end. They differ in how the card details are collected.
On the web, a hosted payment page or embedded fields from a JS SDK keep card numbers off the merchant's servers. In apps, iOS and Android SDKs do the same job, and wallets such as Apple Pay and Google Pay hand the gateway a token instead of a card number. A mobile payment gateway architecture therefore adds SDK release management and wallet token handling to the same core.
Design choices that decide reliability
A gateway fails in the middle of someone's checkout, so its design has to assume parts will break. These choices matter most.
- Idempotency keys on every payment request, so a retry never charges a card twice
- Asynchronous queues between components, so a slow acquirer doesn't block the merchant API
- Health checks per connector, so routing stops sending traffic to one that's failing
- Replicated databases across locations, with backups inside and between them
- Monitoring with real-time alerts on approval rates, latency and error codes per acquirer
Microservices make these easier, since each component scales and fails on its own. They also add network calls and operational work, which is why a gateway team needs strong monitoring from the first release.
How our gateway is built
Our gateway follows this architecture. It runs on microservices across several nodes in different locations, with replicated relational databases and Elasticsearch shards, backups within and between nodes, and automated monitoring with real-time alerts.
Card data sits in a tokenization vault with network tokenization for stored cards. 3-D Secure runs on the platform or through an external MPI, and 150 built-in configurable fraud filters screen payments before routing. Routing and cascading work across 700+ ready connectors, and the platform is PCI DSS v4.0.1 Level 1 certified.
It deploys as SaaS with a 99.95% uptime SLA, in your own cloud account or on your own servers, so the same architecture can run inside your country. That's a long list to build a gateway from scratch, and licensing it skips the build.
Questions
What are the components of payment gateway development?
A merchant API, a hosted payment page and SDKs, a tokenization vault with key management, a routing engine, connectors to acquirers, 3-D Secure, a fraud engine, a merchant back office, reporting, admin with an audit trail and monitoring.
Which parts of a payment gateway are in PCI DSS scope?
Every component that stores, processes or transmits card data, plus systems connected to them. Segmenting the vault, key management, payment page and card connectors keeps the rest of the platform out of scope.
Is a microservices architecture required for a payment gateway?
No, but it helps. Separate services let the vault, routing and connectors scale and fail independently, at the cost of more network calls and more monitoring.
How does a payment gateway handle an acquirer outage?
Health checks per connector let routing stop sending traffic to a failing acquirer and send payments to a fallback route instead.