React
The React hooks are the most ergonomic path when you want a payment-aware UI instead of manually orchestrating status, balances, and retry state yourself.
useX402Payment
The main React entrypoint is useX402Payment.
Why This Is Better Than Wiring It Yourself
The hook consolidates:
- payment state
- request lifecycle
- balances
- transaction links
- error handling
That is especially useful in applications where the same user may pay across more than one screen.
Recommended UI Pattern
A practical pattern is:
- show whether the wallet is connected
- show known balance state
- keep the payment action explicit
- surface the transaction URL after settlement
When To Reach For useAccessPass
If your product has repeated reads against the same protected surface, useAccessPass usually creates a better UX than signing every request individually.
Read next: