Skip to main content
This guide shows how to pay for x402-protected resources using a WDK self-custodial wallet on Plasma or Stable. By the end you’ll have a working fetch wrapper that automatically handles 402 Payment Required responses with USD₮.
See a full working demo at github.com/SemanticPay/x402-usdt0-demo

Install

Create a wallet

Create a WalletAccountEvm pointed at the chain you want to pay on. The account derives keys locally from your seed phrase.

Register with x402

WalletAccountEvm already satisfies the signer interface that x402 expects.
That’s it. fetchWithPayment now intercepts any 402 Payment Required response, signs an EIP-3009 transferWithAuthorization using your WDK wallet, and retries the request with the payment header attached.

Make a paid request

If the endpoint requires payment, the x402 client handles the full flow automatically:
  1. Initial request returns 402 with a PAYMENT-REQUIRED header
  2. Client parses the payment requirements (amount, token, network, recipient)
  3. Client signs an EIP-3009 authorization with your WDK wallet
  4. Client retries the request with the PAYMENT-SIGNATURE header
  5. The facilitator settles the payment on-chain and the server returns the resource

Full example

Environment variables

Your seed phrase controls your funds. Never commit it to version control. Use environment variables or a secrets manager.

Checking your balance

Before making paid requests, verify your wallet has USDT0 on the target chain:
USDT0 uses 6 decimals. A balance of 1000000 equals 1.00 USDâ‚®.

Using Axios instead of fetch

What happens under the hood

x402 uses EIP-3009 (transferWithAuthorization) for payment settlement. When your WDK wallet signs a payment, it creates an off-chain authorization that allows the facilitator to transfer a specific amount of USDT0 from your address to the seller’s address. The facilitator then submits this authorization on-chain in a single transaction. Because Plasma and Stable both support EIP-3009 natively on their USDT0 contracts, the facilitator can settle payments without any gas cost to the buyer. The buyer only pays the exact amount specified in the payment requirements.
Last modified on February 17, 2026