Skip to main content
@faremeter/rides is the fastest way to start making x402 payments. It auto-detects your wallet type and handles payment negotiation transparently.
Prefer a ready-made environment? The TypeScript Playground has all @faremeter/* packages pre-configured in a monorepo — clone it and start building under apps/.

Prerequisites

  • Node.js 18+
  • A Solana devnet keypair file or an EVM private key
1

Install

2

Configure your wallet

Create a .env file with your wallet credentials:
.env
For instructions on creating and funding a wallet, see Wallet Setup.
3

Make a payment

main.ts
Run it:

What happened

  1. payer.fetch made an HTTP request to the endpoint.
  2. The server responded with 402 Payment Required and a set of payment requirements.
  3. Rides found a compatible wallet, signed the payment locally, and retried the request with a payment header (X-PAYMENT for v1, PAYMENT-SIGNATURE for v2).
  4. The server verified the payment through a facilitator and returned the resource.
Your code made a single fetch call. Faremeter handled everything else.

Other wallet types

This quickstart uses addLocalWallet, 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.