@faremeter/rides is the fastest way to start making x402 payments. It auto-detects your wallet type and handles payment negotiation transparently.
Prerequisites
- Node.js 18+
- A Solana devnet keypair file or an EVM private key
Configure your wallet
Create a For instructions on creating and funding a wallet, see Wallet Setup.
.env file with your wallet credentials:.env
What happened
payer.fetchmade an HTTP request to the endpoint.- The server responded with
402 Payment Requiredand a set of payment requirements. - Rides found a compatible wallet, signed the payment locally, and retried the request with a payment header (
X-PAYMENTfor v1,PAYMENT-SIGNATUREfor v2). - The server verified the payment through a facilitator and returned the resource.
fetch call. Faremeter handled everything else.
Other wallet types
This quickstart usesaddLocalWallet, which auto-detects raw key material. For wallet adapters that manage keys differently — such as OWS vaults, Ledger hardware, or Crossmint custodial wallets — use addWalletAdapter instead. See the Rides SDK docs for details.
Next steps
- How x402 works — Understand the protocol behind the payment flow.
- Rides SDK — Full API reference for
@faremeter/rides. - Fetch Wrapper — Lower-level control with
@faremeter/fetch. - Middleware — Accept payments on your own server.