@faremeter/rides is the simplest way to use faremeter. It bundles all payment handlers and wallet adapters into a single package with automatic wallet detection.
Basic usage
The payer singleton
payer is a pre-configured singleton with sensible defaults. It supports all chains and assets out of the box.
addLocalWallet
- File path (e.g.,
~/.config/solana/id.json) — Treated as a Solana keypair file. - JSON array (e.g.,
[123, 45, ...]) — Treated as Solana keypair bytes. - Base64 string — Treated as a Solana keypair.
- Hex string starting with
0x— Treated as an EVM private key.
addWalletAdapter
addLocalWallet cannot auto-detect, such as OWS, Ledger, or Crossmint wallets.
A WalletAdapter has three fields:
| Field | Type | Description |
|---|---|---|
x402Id | PaymentIdV2[] | Payment schemes this wallet supports (scheme, network, asset). |
paymentHandler | PaymentHandler | The payment handler that uses this wallet for signing. |
getBalance | () => Promise<Balance> | Returns the wallet’s current balance for pre-payment checks. |
fetch
fetch. If the server responds with 402, rides handles payment negotiation and retries the request automatically.
createPayer
For more control, create a custom payer instance:
Options
| Option | Type | Default | Description |
|---|---|---|---|
networks | KnownNetwork[] | All supported | Restrict to specific networks. |
assets | KnownAsset[] | All supported | Restrict to specific assets. |
options.disableBalanceChecks | boolean | false | Skip balance checks before payment. |
options.fetch | WrapOpts | — | Pass-through options for the underlying fetch wrapper. |
Multi-chain support
Add wallets for different chains. Rides selects the correct one based on the server’s payment requirements.When to use rides vs fetch
Use rides when:- You want the fastest setup with minimal configuration.
- You do not need custom payer selection logic.
- You are building a simple agent or script.
@faremeter/fetch when:
- You need custom payment handlers or payer choosers.
- You want to control which handlers are registered.
- You need separate fetch instances with different configurations.