Browser Client
Client integration
Automatic 402 handling in wallet-connected UIs
Use the browser client when you want fetch-like ergonomics with real x402 payment behavior, multi-wallet awareness, and explicit network control.
Use the browser client when your application already has wallet connectivity and you want fetch() to become payment-aware.
Best Fit
This path is ideal for:
- consumer web apps
- dashboards and internal tools
- agent-adjacent browser UIs
- flows where a human wallet confirms payment in the browser
Minimal Example
What This Does
When the endpoint returns 402 Payment Required, the client:
- parses the payment requirements
- picks a compatible wallet/network
- signs the payment
- retries the request automatically
Adding Custom RPC URLs
Use custom RPC URLs when you need explicit provider control instead of the Dexter defaults.
Recommended Production Pattern
Keep the x402 client near your API layer rather than scattering payment behavior across components.
That gives you one place to control:
- wallet selection
- preferred network
- payment caps
- RPC policy
When To Use Something Else
- Use React when you want hook-based state and UI helpers.
- Use Merchant Quickstart for the server side.
- Use Access Pass when pay-per-request is too granular.