What can be extended
| Plugin type | Interface | Use case |
|---|---|---|
| Wallet adapter | createLocalWallet() pattern | Support a new wallet type (hardware, custodial, multisig) |
| Payment handler | PaymentHandler | Support a new blockchain or payment scheme on the client |
| Facilitator handler | FacilitatorHandler | Support a new blockchain or scheme on the facilitator |
| Middleware adapter | handleMiddlewareRequest() | Integrate with a framework beyond Express and Hono |
Building a custom wallet adapter
A wallet adapter is a factory function that returns an object capable of signing payment proofs. The exact shape depends on the chain, but the pattern is the same: accept credentials, return a signer.Building a custom payment handler
A payment handler bridges a wallet and a payment scheme. It receives payment requirements from a 402 response and returnsPaymentExecer objects for any requirements it can fulfill.
Building a custom facilitator handler
To support a new chain on the facilitator side, implement theFacilitatorHandler interface:
null from handleSettle and handleVerify for schemes they don’t support, allowing multiple handlers to coexist. See Facilitator for the full setup.
Building a custom middleware adapter
If you use a framework other than Express or Hono, usehandleMiddlewareRequest from @faremeter/middleware/common to wire up the payment flow manually. You provide functions to read headers, send responses, and handle the request body.
Publishing plugins
When publishing a faremeter plugin:- Use the naming convention
faremeter-*or@your-scope/faremeter-*for discoverability. - Declare
@faremeter/typesas a peer dependency for type compatibility. - Export your factory functions as the package’s public API.
- Include a README with a working example.
Plugin registry
Visit the faremeter plugin registry to browse community-contributed packages.Further reading
- Payment Handlers — The client-side plugin interface.
- Wallets & Signing — The wallet adapter pattern.
- Facilitator — Running and extending your own facilitator.
- Middleware Overview — Server-side middleware and the
commonmodule.