
Architecting a PCI-Ready Digital Wallet on AWS: Services, Patterns, and Pitfalls
What's your experience — DynamoDB or Aurora for ledgers? Fraud Detector or straight to custom models? I'd love to compare notes in the comments.
Fintech is one of the fastest-growing workloads on AWS — and digital wallets are among the most demanding products you can build there. A wallet holds money, identity, and trust, which means your architecture has to answer three questions before a single feature ships: How do we keep the money correct? How do we keep the data safe? How do we prove both to an auditor?
Having shipped multiple wallet and payments platforms on AWS, here's the architecture playbook I wish someone had handed me on day one — the services that fit each layer, the patterns that matter, and the pitfalls that cost teams months.
The Reference Architecture at a Glance
A production wallet on AWS typically breaks into six layers:
- Edge & API — CloudFront + AWS WAF + Amazon API Gateway
- Identity & Consent — Amazon Cognito + fine-grained authorization
- Ledger & Transactions — DynamoDB (or Aurora) with event sourcing via EventBridge/Kinesis
- Payments Integration — Lambda/Step Functions orchestrating external rails (cards, A2A, open banking APIs)
- Risk & Fraud — Amazon Fraud Detector + SageMaker for custom models
- Compliance & Observability — KMS, CloudTrail, Security Hub, and immutable audit logs
Let's walk through the decisions that matter in each.
1. Identity: Cognito Is the Start, Not the End
Amazon Cognito handles sign-up, sign-in, MFA, and token issuance well, and its integration with API Gateway authorizers keeps auth logic out of your business code. For a wallet, though, plan beyond the basics:
- Device binding. Store device fingerprints as custom attributes and require step-up authentication (TOTP or WebAuthn/passkeys) when a token appears on a new device. Account takeover is the #1 wallet attack vector.
- KYC orchestration. Model onboarding as a Step Functions state machine: document capture → identity verification provider → sanctions/PEP screening → risk scoring → account activation. State machines give you retry semantics, human-review branches, and an audit trail of every decision for free.
- Consent as data. If you're touching open banking APIs, treat user consent as a first-class entity with scope, expiry, and revocation — a DynamoDB table with TTL attributes maps to this beautifully.
Pitfall: don't put PII in JWT claims. Tokens leak into logs. Keep claims minimal and resolve identity server-side.
2. The Ledger: Correctness Beats Cleverness
The heart of a wallet is a double-entry ledger, and this is where most architectural regret originates. Two viable AWS paths:
DynamoDB with single-table design. Model accounts and entries so every transfer writes exactly two entries (debit + credit) in one
TransactWriteItems call — atomicity guaranteed, horizontal scale built in. Use condition expressions to enforce non-negative balances at write time.Aurora PostgreSQL. If your team thinks in SQL and you need complex queries (statements, reconciliation, reporting), Aurora with serializable isolation for transfer transactions is the pragmatic choice. You trade some scale ceiling for enormous queryability.
Either way, three rules are non-negotiable:
- Idempotency keys on every money-moving API. Clients retry; networks fail. An
idempotency_keychecked via conditional write turns duplicate requests into no-ops instead of duplicate payouts.
- Append-only entries. Never UPDATE a ledger row. Corrections are new reversing entries. Auditors — and your future self during incident response — will thank you.
- Event sourcing for downstream consumers. Publish every ledger event to EventBridge. Notifications, analytics, fraud scoring, and webhooks all subscribe without touching the write path.
Pitfall: calculating balances by summing entries at read time works until it doesn't. Maintain materialized balance items updated in the same transaction, and run a nightly reconciliation job (Lambda + Step Functions) that recomputes from entries and alarms on drift.
3. Payments Orchestration: Assume Everything Fails
External payment rails — card processors, A2A/open banking providers, payout partners — fail partially and often. Step Functions is the right tool for multi-step money movement:
- Explicit states for
initiated → pending → settled → failed → reversed
- Timeouts and catch blocks on every external call
- A dead-letter pattern (SQS DLQ) for human-review cases
Webhooks from providers deserve equal rigor: verify signatures, process through SQS for buffering, and make handlers idempotent — providers will deliver duplicates.
Pitfall: PCI DSS scope. Never let raw PANs touch your compute. Use your processor's tokenization (hosted fields / SDK capture) so card data flows directly from client to processor. Your AWS environment then handles only tokens, collapsing your PCI scope from "entire platform" to nearly nothing. This single decision saves months of audit effort.
4. Fraud: Managed First, Custom Later
Amazon Fraud Detector gives you a trained-on-AWS-scale baseline for new-account fraud and transaction risk with days of setup, not months. Start there; feed it device, velocity, and behavioral features via your EventBridge stream.
Graduate to SageMaker when you have labeled outcomes and need custom features (transaction graphs, session behavior). Log every score and decision — under emerging regulation like the EU AI Act, credit and fraud models are high-risk systems requiring explainability and audit trails. Architect the paper trail now.
5. Compliance and Observability: Design for the Auditor
- KMS everywhere — customer-managed keys per data classification, with key policies as code
- CloudTrail + AWS Config — org-level trails to a locked, Object-Lock-enabled S3 bucket (WORM storage satisfies immutability requirements)
- Security Hub + GuardDuty — continuous posture monitoring mapped to PCI DSS controls
- Structured audit events — a dedicated audit stream answering who did what to whose money when — distinct from application logs
Pitfall: treating compliance as a pre-launch checklist. Encode it as architecture — SCPs, permission boundaries, and Config rules — and audits become demonstrations instead of archaeology.
What This Looks Like in Practice
A minimal serverless wallet slice: CloudFront → WAF → API Gateway (Cognito authorizer) → Lambda → DynamoDB
TransactWriteItems for the double-entry write → EventBridge fan-out → Fraud Detector scoring + SQS-buffered webhook delivery, with KMS encryption and CloudTrail underneath everything. That stack scales from prototype to millions of transactions with essentially zero idle cost — which is why serverless has become the default starting point for wallet MVPs in our fintech app development work, and why the pattern holds up even as products graduate to multi-region.Closing Thoughts
Wallet architecture on AWS isn't about exotic services — it's about boring correctness: idempotency, append-only ledgers, tokenized PCI scope, state-machine orchestration, and audit trails designed in rather than bolted on. Get those five right and the feature roadmap gets dramatically easier.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article