# A payments API built like Lego

https://shubhamnagota.com/work/composable-payments-api

Small, reusable blocks that compose into full flows. New business use cases get assembled from what exists instead of built from scratch.

## Problem

TransFi's volume grew from $20M to $150M+ a month across 40+ countries and 250+ payment methods. Every new business use case needs some mix of the same steps: identity checks, a quote, collecting funds, holding them, converting through stablecoins and paying out.

## Constraints

- Local rails and stablecoin infrastructure behave very differently, but clients need one consistent API.
- Partners go down, slow down or run out of balance, so routing can't be hard-coded.

## What I built

A payments API built from small, reusable building blocks. Each block does one job. Blocks compose into end-to-end flows, and new business use cases are assembled from blocks that already exist instead of being built from scratch.

Diagram: building blocks (KYC, Quote, Payin, Wallet, Stablecoin, Payout) compose into 15 end-to-end flows for 10+ business use cases across FX, Ramp and Gaming.

- One API for payins and payouts, with standardized error codes, over both local rails and stablecoin infrastructure.
- Dynamic routing across partners, based on speed, downtime and balance availability.

## Outcome

- 15 end-to-end flows built from the shared blocks.
- 10+ business use cases supported.
- 3 verticals: FX, Ramp and Gaming.
