x402 Progressive Demo · Chapter 1 of 7

Single Recipient

Can you move real money on a blockchain from a browser?
Published 2026-04-16 · Northwoods Software · x402 Payment Protocol

The Simplest Possible Payment

One HTML file. One wallet. One blockchain. No backend, no database, no API keys. A buyer opens a web page, clicks a button, approves a transaction in their Phantom wallet, and one cent of USDC moves from their wallet to the recipient's wallet on Solana. On this public site that is Solana devnet, with test USDC from a faucet, so no real money is at stake.

That's it. That's the entire payment stack.

This is the primitive that everything else builds on. Every chapter that follows — dynamic recipients, content paywalls, multi-chain support, mobile payments, automated testing, monitored addresses — uses the same underlying transfer. The protocol never changes. Only what's built on top of it does.

What Happens When You Click "Pay"

  1. The page asks Phantom to connect (the buyer sees a popup asking for permission)
  2. JavaScript builds a USDC transfer instruction: "send $0.01 from this wallet to that wallet"
  3. Phantom shows the transaction details and asks the buyer to approve
  4. The signed transaction is submitted directly to Solana (devnet, on this site)
  5. In about 1 second, the transfer settles on-chain — permanent, verifiable, irreversible
  6. The page shows a receipt with a link to verify on Solscan (the Solana block explorer)

The Code

The entire payment flow is three lines of meaningful code:

const TO = quote.accepts[0].payTo   // the recipient the server's 402 names
const tx = buildUsdcTransfer(payer, TO, 0.01)
await phantom.signTransaction(tx)

Everything else — connecting the wallet, constructing the SPL Token instruction, submitting to the RPC, polling for confirmation — is boilerplate that every Solana payment shares. The protocol primitive is just: build a transfer, sign it, submit it.

What This Proves

Why USDC, not SOL? USDC is a stablecoin — 1 USDC is always worth $1 USD, backed by cash reserves at Circle. SOL is a volatile cryptocurrency whose price changes constantly. When a shirt costs $12, the buyer should pay $12 — not "however much SOL $12 buys at this moment, which might be $11.50 by the time the seller checks." Stablecoins make crypto payments predictable for both sides.

What's Next

This chapter hardcodes a single recipient. In Chapter 2, the buyer picks who to pay from a dropdown — proving the protocol scales to any number of recipients without changing the payment code.