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.

Prerequisites

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

Install

pnpm add @faremeter/rides
2

Configure your wallet

Create a .env file with your wallet credentials:
.env
# Solana keypair file path
PAYER_KEYPAIR_PATH=~/.config/solana/id.json

# OR EVM private key
EVM_PRIVATE_KEY=0x...
You can provide one or both. Rides auto-detects the wallet type from the input.
3

Make a payment

main.ts
import "dotenv/config"
import { payer } from "@faremeter/rides"
import { getLogger } from "@faremeter/logs"

const logger = await getLogger(["quickstart"])

await payer.addLocalWallet(process.env.PAYER_KEYPAIR_PATH)

const response = await payer.fetch("https://helius.api.corbits.dev")

logger.info(`status: ${response.status}`)
logger.info(JSON.stringify(await response.json()))
Run it:
pnpm tsx main.ts

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 an X-PAYMENT header.
  4. The server verified the payment through a facilitator and returned the resource.
Your code made a single fetch call. Faremeter handled everything else.

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.