Available on crate feature
client only.Expand description
Lifecycle hooks for the x402 client payment creation pipeline.
Hooks allow applications to intercept and customize the payment
creation lifecycle. This mirrors the Go SDK’s client_hooks.go design,
using the same HookDecision / FailureRecovery enums as the
server-side hooks for a consistent API.
§Hook Lifecycle
before_payment_creation— Run before payment creation; can abort it.- Payment signing executes
after_payment_creation(on success) — Observes the result.on_payment_creation_failure(on error) — Can recover with substitute headers.
§Usage
Implement ClientHooks with only the hooks you need — all methods
have default no-op implementations.
Structs§
- Payment
Creation Context - Context passed to client payment creation lifecycle hooks.
Traits§
- Client
Hooks - Lifecycle hooks for client-side payment creation.