
Merchants wanted stablecoin payments without a custodian sitting on their money, with the guarantees a card gateway gives: every payment recorded once, clear statuses and reliable notifications.
What I built
A router smart contract that splits each payment between the merchant and the platform in one transaction, live on four chains.
A NestJS backend on PostgreSQL, Redis and BullMQ. A payment reaches us two ways, from the checkout and from a background job that reads contract events every minute. Both go through one recording function guarded by a unique constraint, so a payment is recorded exactly once.
A verifier that waits for finality (block depth or the chain's finalized tag) and re-checks recent payments for chain reorganisations.
Discrepancy handling for underpaid, overpaid, wrong-token and late payments, recorded in the same transaction as the status change, with a webhook to the merchant.
Signed webhooks (HMAC-SHA256 over a timestamp and the raw body), written to an outbox in the same transaction and delivered with backoff and a dead-letter state.
A merchant console with API keys, two-factor sign-in (authenticator app or passkey), refunds and reporting.
The result
Live in production on four chains. A browser test that closes the checkout mid-payment still sees the order complete in about 18 seconds, because the background discovery path picks it up.
Stack: TypeScript, NestJS, Prisma, PostgreSQL, Redis, BullMQ, Solidity, Next.js
0 likes · 2 views · Oct 30, 2026
Stablecoin payment gateway I co-founded and built. USDT and USDC land in the merchant's wallet in one transaction. Live on four chains.