Skip to main content

Module status

Module status 

Source
Available on crate feature server only.
Expand description

Maps x402 error reasons to HTTP status codes.

Per x402 v2 §HTTP transport error mapping. The default status for a payment failure is 402 Payment Required; a few reasons use other statuses to signal out-of-band preconditions:

ErrorReasonHTTP status
Permit2AllowanceRequired412 Precondition Failed
anything else402 Payment Required

Functions§

reason_to_status
Returns the HTTP status corresponding to an ErrorReason.