Skip to content

Payments Gateway — Technical Deep-Dive

The Payments Gateway is the centralized payment processing platform for Acme Financial Services, handling all card transactions (acquiring and issuing), wire transfers (domestic and cross-border), ACH origination and receipt, SEPA credit transfers and direct debits, and FedNow instant payment receipt.

AttributeDetail
Primary LanguageJava 17 (LTS)
FrameworkSpring Boot 3.2, Spring Kafka, Spring WebFlux (reactive endpoints)
MessagingApache Kafka 3.6 (Confluent Platform 7.6)
DatabasePostgreSQL 15 (Azure Database for PostgreSQL — Flexible Server)
CacheRedis 7 (Azure Cache for Redis Enterprise, geo-replicated)
DeploymentAKS 1.28, PCI-DSS dedicated cluster (aks-prod-pci)
Team Size30 engineers (backend, QA, SRE, compliance)
SLATier 1 — 99.99 % monthly uptime (~4.3 min tolerated downtime/month)
RTO / RPO10 min / < 1 second (streaming replication)
Repositoriesacme-payments-auth, acme-payments-clearing, acme-payments-settlement, acme-payments-disputes
ChannelAverage Daily VolumePeak (Month-End / Payroll)
Card transactions (acquiring + issuing)~1,200,000~2,000,000
Wire transfers (Fedwire + SWIFT)~50,000~80,000
ACH (origination + receipt)~200,000~350,000
SEPA (SCT + SDD)~15,000~25,000
FedNow (receive-only)~5,000~12,000

Acme processes card-present (CP) and card-not-present (CNP) transactions on behalf of merchant clients through direct connections to Visa (VisaNet) and Mastercard (Banknet) via an acquiring processor. Authorization requests are routed, approved or declined, and a real-time authorization response is returned to the merchant terminal or e-commerce gateway within the p99 latency SLA.

For Acme-issued debit and credit cards, the Payments Gateway receives incoming authorization requests from the card networks, performs balance/credit-limit checks against Core Banking, applies fraud rules via the Risk Engine, and returns an approve or decline response.

All CNP transactions require 3-D Secure 2 (3DS2) authentication orchestrated via an EMVCo-certified Access Control Server (ACS). The frictionless flow handles approximately 85 % of authentications; the remaining 15 % trigger a step-up challenge (OTP or biometric).

Primary Account Numbers (PANs) are tokenized at the point of entry using HSM-generated format-preserving tokens. Downstream services — including Core Banking, Risk Engine, and the Data Warehouse — only receive opaque tokens. The token vault is housed within the PCI CDE and accessible exclusively by the authorization service.

  • Outbound: Initiated via Core Banking or the Wealth Management Portal. The Payments Gateway validates the request, performs OFAC screening (via Risk Engine), and submits to the Federal Reserve via the Fedwire Funds Service.
  • Inbound: Received from Fedwire, matched to the beneficiary account in Core Banking, and credited.
  • Cut-off times: Outbound Fedwire submissions close at 6:00 PM ET (customer-initiated) and 6:30 PM ET (bank-initiated).

Cross-border wires are transmitted via the SWIFT network using Alliance Lite2 (see Section 7 for integration details). Message types include:

MT TypeDescriptionDirection
MT103Single Customer Credit TransferOutbound / Inbound
MT202General Financial Institution TransferOutbound / Inbound
MT940Customer Statement (end-of-day)Inbound (from correspondent banks)
MT199Free-format message (queries/investigations)Bidirectional
MT299Free-format message (treasury)Bidirectional
  • Origination: Acme originates ACH credits (payroll, vendor payments) and debits (loan payments, recurring billing) via the Federal Reserve’s FedACH service.
  • Receipt: Inbound ACH entries are received, validated, and posted to customer accounts.
  • Same-Day ACH: Supported for both origination and receipt. Same-day window cut-off times: 10:30 AM ET, 2:45 PM ET.
  • Returns: Return reason codes R01 through R85 are processed. Common returns (R01 — Insufficient Funds, R02 — Account Closed, R03 — No Account) are auto-resolved; others are routed to the Operations team.
  • SEPA Credit Transfer (SCT): EUR-denominated credit transfers to EEA beneficiaries, submitted via a SEPA-connected correspondent bank.
  • SEPA Direct Debit (SDD): Collection of EUR receivables from EEA debtors under a signed mandate.
  • ISO 20022: All SEPA messages use ISO 20022 XML schemas (pain.001, pain.008, pacs.008, camt.053).
  • Receive-only: Acme currently supports receiving FedNow instant payments. Outbound origination is on the 2025 H2 roadmap.
  • Transaction limit: $500,000 per transaction (Federal Reserve network limit).
  • Availability: 24/7/365 — no cut-off times.

Every payment — regardless of channel — passes through a standardized processing pipeline:

StepActionLatency BudgetKey Component
1Initiate—API Gateway receives request; assigns UUID v7 payment ID
2Validate< 20 msSchema validation, currency check, duplicate detection (Redis idempotency), account status verification
3Screen< 100 msSynchronous call to Risk Engine: OFAC/sanctions screening, fraud scoring, AML rule evaluation
4Authorize< 50 msBalance/credit-limit hold (Core Banking REST call for issuing), card network authorization (VisaNet/Banknet for acquiring), Fedwire submission
5ClearBatch (card) / Real-time (wire/ACH)Card clearing files (TC/IPM) generated nightly; wires clear upon Fedwire/SWIFT confirmation; ACH files submitted per window
6SettleT+0 to T+2Net settlement with card networks; gross settlement for wires; net settlement for ACH
End-to-end (auth)< 500 ms (p99)
MetricTargetActual (30-day avg)
Authorization p50< 150 ms120 ms
Authorization p95< 350 ms280 ms
Authorization p99< 500 ms420 ms
Screening (Risk Engine) p99< 100 ms72 ms
Validation p99< 20 ms12 ms

Kafka is the backbone for asynchronous communication within the Payments domain and with downstream systems.

TopicPartition KeyPartitionsProducersConsumersRetentionSchema
payments.payment.initiatedpayment_id64Authorization ServiceClearing Service, Data Warehouse7 daysAvro (PaymentInitiated.avsc)
payments.payment.authorizedpayment_id64Authorization ServiceCore Banking, Clearing Service, Risk Engine7 daysAvro (PaymentAuthorized.avsc)
payments.payment.settledpayment_id32Settlement ServiceCore Banking, Data Warehouse, Regulatory Reporting30 daysAvro (PaymentSettled.avsc)
payments.payment.failedpayment_id32Authorization Service, Clearing ServiceDisputes Service, Data Warehouse30 daysAvro (PaymentFailed.avsc)
payments.payment.reversedpayment_id32Disputes ServiceCore Banking, Settlement Service, Data Warehouse30 daysAvro (PaymentReversed.avsc)
# Producer configuration (authorization-service)
spring:
kafka:
producer:
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS}
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
acks: all
retries: 2147483647
enable.idempotence: true
transactional.id: auth-svc-${POD_NAME}
max.in.flight.requests.per.connection: 5
compression.type: zstd
consumer:
isolation.level: read_committed
auto.offset.reset: earliest
enable.auto.commit: false
max.poll.records: 500
  • Exactly-once semantics (EOS): Enabled via transactional producers (enable.idempotence=true, transactional.id) and read_committed consumer isolation level.
  • Schema governance: All topic schemas are registered in Confluent Schema Registry with backward compatibility enforced. Breaking changes require ARB approval and a phased migration plan.
  • Consumer lag monitoring: Datadog monitors consumer group lag for every consumer. Alert thresholds: P3 if lag exceeds 10,000 messages for 5 minutes; P2 if lag exceeds 100,000 messages.

The CDE is a network-isolated segment within the aks-prod-pci cluster. It contains:

  • Authorization Service — Processes card authorization requests; has access to the token vault and HSM.
  • Token Vault — PostgreSQL instance storing PAN-to-token mappings, encrypted at rest (pgcrypto AES-256) and column-level encrypted.
  • HSM Gateway — Proxy service for Azure Dedicated HSM (Thales Luna 7) operations.
OperationHSM FunctionProtocol
PAN encryption/decryptionAES-256-GCM encrypt/decryptPKCS#11
PIN translation (issuing)3DES PIN block translatePKCS#11
Token generationFormat-preserving encryption (FF1)PKCS#11
Key wrapping (BYOK)AES key wrapPKCS#11
Digital signing (SWIFT)RSA-2048 / ECDSA P-256PKCS#11

HSMs are FIPS 140-2 Level 3 validated. Key ceremonies (generation, rotation, destruction) require dual control with split knowledge, witnessed by Information Security and Compliance personnel. Key rotation occurs annually or immediately upon suspected compromise.

  • CVV/CVC: Never stored. Used only in-memory during the authorization request and discarded.
  • PAN: Tokenized at entry; only the token vault (inside CDE) holds the mapping.
  • Magnetic stripe data: Never stored.
  • Cardholder name: Stored only where required for clearing/dispute purposes; encrypted at rest.
  • CDE Kubernetes namespace uses Calico NetworkPolicy with default-deny ingress and egress.
  • Only the API Gateway (APIM) and the Clearing Service can initiate connections to the Authorization Service.
  • SSH access to CDE nodes is disabled; all administration via kubectl through a Bastion host with MFA and session recording.
  • Access reviews are conducted quarterly; all access is logged and retained for 1 year.
ActivityFrequencyPerformed By
PCI DSS Level 1 assessment (ROC)AnnualExternal QSA (Coalfire)
ASV vulnerability scanQuarterlyQualys
Penetration test (external + internal)AnnualBishop Fox
Internal vulnerability scanMonthlyQualys + Snyk
Code review (SAST)Every PRCheckmarx (automated in CI)
Log reviewDaily (automated) + weekly (manual)SRE + InfoSec

SWIFT connectivity is provided by Alliance Lite2, a cloud-based SWIFT interface hosted on a dedicated on-premises appliance connected to Azure via ExpressRoute. Alliance Lite2 provides:

  • FIN messaging — Structured financial messages (MT series).
  • FileAct — Bulk file transfers for clearing and reporting.
  • SWIFTNet Link — Secure IP connectivity to the SWIFT network.
Payments Gateway → Alliance Lite2 Appliance → SWIFTNet → Correspondent Bank
(ExpressRoute) (FIN/FileAct)
MessageDirectionPurposeDaily Volume
MT103Outbound / InboundSingle customer credit transfer~35,000
MT202Outbound / InboundBank-to-bank transfer (cover payment)~10,000
MT940InboundEnd-of-day account statement from correspondents~200
MT199BidirectionalFree-format inquiry / investigation~500
MT299BidirectionalFree-format treasury message~100

Every outbound SWIFT message is screened against sanctions lists before transmission:

  1. Pre-screening: The Payments Gateway calls the Risk Engine, which queries Refinitiv World-Check One and the OFAC SDN list.
  2. Hit resolution: True hits are blocked and routed to the BSA/AML Compliance team for investigation. False positives are documented and released with dual approval.
  3. Post-screening: Inbound MT103/MT202 messages are screened upon receipt before crediting the beneficiary account.

SWIFT’s ISO 20022 migration (effective November 2025 for cross-border payments) requires support for MX message equivalents:

Legacy MTISO 20022 MX EquivalentMigration Status
MT103pacs.008Development complete; UAT in progress
MT202pacs.009Development complete; UAT in progress
MT940camt.053Development complete; production pilot Q2 2025
MT199— (free-format retained)No change required

The Payments Gateway implements a dual-format adapter that can send and receive both MT and MX formats during the coexistence period. Message translation is handled by an in-house library (acme-swift-translator) with comprehensive round-trip test coverage.


Payment processing requires robust idempotency to prevent duplicate authorization, double settlement, or repeated fund movement.

Every mutating API call must include an Idempotency-Key header (UUID v7). The Authorization Service checks Redis for the key before processing:

  • Cache hit: Return the stored response without re-executing the operation.
  • Cache miss: Process the request, store the response in Redis with a 72-hour TTL, and return the result.

Redis is deployed as an Azure Cache for Redis Enterprise (6-node cluster, active geo-replication between East US and West US 2).

Kafka producers are configured with enable.idempotence=true and transactional IDs, ensuring that retried produces do not result in duplicate messages on the broker.

Settlement files and instructions include a unique settlement batch ID. The settlement engine checks for prior processing of the batch ID before executing. If a duplicate batch is detected, the engine logs a warning and skips re-processing.

The payment ID (UUID v7, assigned at initiation) is propagated through every stage of the pipeline. Each stage (authorize, clear, settle) maintains its own processed-ID set, ensuring that even if an upstream retry occurs, the downstream stage does not re-execute.


DashboardKey Widgets
Payments — AuthorizationAuth success rate (target > 99.5 %), decline reason distribution, latency heatmap (p50/p95/p99), throughput (TPS), error rate by HTTP status
Payments — KafkaConsumer lag per group, producer throughput, broker disk usage, partition distribution, under-replicated partitions
Payments — SettlementSettlement file generation status, net settlement position, reconciliation break count, settlement cycle time
Payments — SWIFTSWIFT queue depth, message delivery latency, NAK rate, sanctions screening hit rate
Payments — PCI ComplianceCDE pod count, network policy violations, HSM operation latency, failed authentication attempts
SLOTargetWindowBurn Rate Alert
Authorization availability99.99 %30-day rollingP1 at 14.4x (1-hour), P2 at 6x (6-hour)
Authorization latency (p99 < 500 ms)99.9 %30-day rollingP2 at 6x (6-hour)
Settlement timeliness (files delivered by cut-off)100 %Per cycleP1 on any miss
SWIFT delivery (MT103 acknowledged within 30 min)99.9 %30-day rollingP2 at 6x (6-hour)
AlertConditionSeverityEscalation
Auth success rate < 99.5 % (5 min)Drop in approval rateP1Payments on-call → VP Engineering (15 min)
Auth p99 > 500 ms (5 min)Latency breachP2Payments on-call
Kafka consumer lag > 100,000 (5 min)Processing backlogP2Payments on-call
SWIFT queue depth > 500 (15 min)SWIFT delivery delayP2Payments on-call + Treasury Ops
HSM operation latency > 50 ms (5 min)HSM degradationP2Payments on-call + InfoSec
PCI CDE network policy violationUnexpected traffic in CDEP1InfoSec on-call → CISO (immediate)
Settlement file not generated by T-30 min before cut-offSettlement delay riskP1Payments on-call + Settlement Ops
Redis replication lag > 5 sCache inconsistency riskP3Payments on-call

ComponentPrimary (East US)DR (West US 2)Replication
PostgreSQLAzure Flexible ServerRead replica (async streaming)< 1 s lag
RedisEnterprise 6-nodeActive geo-replicaSub-second
Kafka6-broker clusterMirrorMaker 2 (async)< 30 s lag
AKSaks-prod-pciaks-dr-pci (warm standby)ArgoCD sync
SWIFT (Alliance Lite2)On-premises appliance— (manual failover to backup appliance)N/A
  1. Detection: Datadog availability monitors detect primary region unavailability (3 consecutive failures over 90 seconds).
  2. Decision: PagerDuty alerts the Payments on-call engineer and VP Engineering. Failover requires explicit approval (no fully automated failover to avoid split-brain).
  3. Execution: Azure Traffic Manager DNS failover routes traffic to West US 2. PostgreSQL replica is promoted. Redis geo-replica becomes primary. Kafka consumers in DR cluster resume from last committed offset.
  4. Validation: Automated smoke tests verify authorization, clearing, and settlement service health.
  5. Communication: Status page updated; stakeholder notification sent via Opsgenie.

DR failover drills are conducted monthly for the Payments Gateway due to its Tier 1 SLA and PCI-DSS requirements.


DateAuthorChange
2025-03-15Payments EngineeringAnnual refresh; added FedNow, ISO 20022 migration status
2024-11-01Payments EngineeringUpdated Kafka to 3.6 (Confluent Platform 7.6)
2024-07-15Security ArchitectureAdded PCI-DSS CDE architecture section
2024-03-01Payments EngineeringInitial publication