What this is
A consumer investment platform: users' idle cash is invested automatically into managed portfolios. Cash moves in and out through several markets, and this work brought inbound international USD transfers, refunds, fraud checks, and a new core ledger to a new market.
The platform runs as about 19 independently deployed AWS CDK apps (TypeScript, Lambda) that talk to each other through a central EventBridge bus, with 60+ SQS-backed consumers.
- Domain
- Consumer investment fintech · payments
- My role
- Backend engineering, rollout point of contact
- Engagement
- Contractor
What needed to be solved
The existing market's deposit logic didn't fit the new one. USD wires needed their own name-matching thresholds. Rejected deposits had to be refunded by hand, net of a processing fee, instead of automatically. Fraud checks were triggered in three different places, each with its own behaviour.
Every money decision also had to be agreed with Compliance and Finance — the edge cases were as much a product problem as a code problem.
What I owned
I was the primary engineering contact for the rollout, working directly with Compliance, Finance, and Product. I designed and built the rejection and manual-refund flow, the centralised fraud-screening event, the new-market ledger integration, and an anti-gaming check for referrals. Changes usually spanned several repos and had to be deployed in order.
- Owned
- Refund flow, fraud event, ledger dispatch, referral checks
- Stakeholders
- Compliance, Finance, Product
Architecture & decisions
Incoming wires arrive as provider webhooks. Before any validation, the pipeline emits a single inward_payment_received event that one dedicated consumer forwards to fraud screening. This replaced three separate per-outcome calls, and existing event-bus rules were left untouched so other markets weren't at risk.
USD deposits use two-tier name matching: a score ≥ 0.8 is accepted and credited, anything lower goes to a suspense account for manual review. The refund fee is computed once, by the payments service that first sees the deposit, and carried in the event; downstream services only write general-ledger entries or refund records. That keeps a single source of truth for money logic.
How it was built
Rejected deposits that never reached the ledger are saved as manual-refund records in DynamoDB, keyed by currency and market. A separate daily batch sends Finance a CSV — deliberately kept apart from the existing failed-auto-refund job, so the two workflows don't get mixed up.
For the new core ledger I implemented eager account creation when a deposit address is requested, a withdrawal-hold dispatcher, fee GL wiring, and daily and monthly returns, all behind feature flags. In code review I fixed an under-count of interest entries with no band, and a month-boundary bug caused by a hard-coded timezone (now chosen per market). I also added a biometric face-match check against self-referral fraud, which is disabled outside production.
- Fraud
- 1 centralised event instead of 3 per-case calls
- Refunds
- Fee computed once → GL + daily Finance CSV
- Ledger
- Feature-flagged dispatch to the new core ledger
Results & lessons
The new market went live with its own deposit, refund, and ledger flows on the shared platform; fraud screening for inbound payments now has one entry point; and Finance gets a single, predictable refund report.
Improvements I identified and wrote up as proposals: (1) a shared idempotency layer — today redelivered SQS messages are handled differently by each consumer, and a duplicate often ends up in the DLQ instead of being skipped; (2) tiered pre-transaction fraud holds — reusing the existing withdrawal hold and callback-based workflow so high-risk transactions are held before money moves, not just alerted on afterwards.
Lesson: in fintech, compute each money decision in exactly one place and pass the result along in events. Duplicated logic is where the bugs hide.
Have a similar challenge?
If you're taking a payment platform into a new market, or untangling event-driven money flows with compliance in the loop, let's talk about your pipeline.