Skip to main content

x402-Pay

Crypto to fiat(inr) instant payments

AIBuild Onchain FBI

About this project

The problem it solves

The Problem

In India, if you hold USDC or any stablecoin, it’s essentially illiquid.

Almost all real-world payments run on UPI. To use your crypto, you’re forced to: • Convert a large amount to INR upfront • Wait for bank settlement • Spend from your bank account

This means your stablecoins are locked behind exchanges, not usable for daily payments. You over-convert, wait, and often end up with unused fiat sitting idle in a bank account.

How x402 Fixes This

x402 enables a pay-per-request payment model.

Instead of converting ₹10,000 upfront and hoping you’ll use it all, you pay exactly what you need, exactly when you need it. • Paying ₹100 for chai? → One request, one signature • Sending ₹5,000 to a friend? → Same flow • No pre-conversion, no waiting, no batching

Here’s how it works: 1. The backend responds with HTTP 402 Payment Required 2. That response specifies exactly how much USDC is needed 3. You sign once with MetaMask 4. The x402 facilitator settles the payment on-chain 5. The receiver instantly gets INR to their UPI ID

Every payment is: • On-chain verified • Non-custodial • Tied to a single API request

Buckets, Pools & Liquidity Providers (INR Side)

To make instant INR payouts possible, x402-Pay uses a bucket-based liquidity system. • Liquidity providers deposit INR into configurable buckets • Each bucket defines: • Exchange rate • Min / max transaction size • Risk and availability parameters • When a payment request comes in, buckets compete in real time • A Dutch-auction style matching engine selects the best combination of buckets

Key Point:

  • Anyone can become a liquidity provider.

If your bucket offers: • Better rates • Reliable availability • Healthy liquidity it gets selected more often, and earns more USDC.

This creates a permissionless, market-driven FX layer where: • No single entity controls pricing • Competition drives better rates • Capital efficiency improves for both users and LPs

Why This Matters for Crypto Adoption in India

This is what finally makes stablecoins usable in India.

Today, holding USDC means very little if you can’t spend it. x402-Pay turns stablecoins into real money for daily life. • Pay anyone with a UPI ID • No onboarding required for receivers • No pre-conversion • No idle fiat

That’s 300+ million UPI users instantly reachable from a crypto wallet.

x402’s pay-per-request model is perfect for daily payments: • You don’t batch-convert and hope • You pay as you go • Every transaction is verifiable on-chain

Stablecoins finally become liquid, spendable, and useful.

Challenges we ran into

First time hearing about x402 didn't even know HTTP 402 was a real status code.

The main challenge was implementing dynamic pricing. Most x402 examples use fixed prices, but our app needs different amounts for each payment. Had to build custom middleware that fetches the quote and returns that exact USDC amount as the x402 price.

Also hit some nasty build issues with WalletConnect + Next.js 16. Packages were bundling test files and breaking the build. Fixed it by switching to webpack and adding aliases to force consistent package versions.

The "sign, don't send" paradigm took a bit to understand, users sign EIP-712 messages and the facilitator does the actual transfer. Once it clicked, I realized how clean this model is for payments.

About the founder

Building on Base from India

Technologies and tags

Next.jsTailwind CSSTypeScriptExpress.js