x402 v2 exact interoperability (HTTP transport, EVM EIP-3009 only).
Protocol authority is the x402 v2 specification
and live facilitator traffic. refs/mppx/src/x402 is the SDK compatibility
target (scheme "exact" only; refs/mppx/src/x402/Types.ts).
challenges_from_header/1 does not take a request URL and does not require
resource.url to equal the response URL. mppx #908 (0.11.0) dropped that
client check: query strings, redirects, proxies, and port rewriting made the
two URLs differ, and the exact match turned a payable offer into a silent
miss. Binding the paid resource stays on MPP.X402.Plug
(:resource_mismatch when the echoed credential resource does not match).
Out of scope: MCP, x402 v1 (X-PAYMENT), non-EVM CAIP-2 families, schemes
other than exact, and Permit2 client signing.
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
chain_id | 1 | Parse eip155:<id> into a positive chain id. | network: value |
exact_request | 1 | Decode the Exact request object stored on a synthetic challenge. | challenge: value |
challenges_from_header | 1 | Parse PAYMENT-REQUIRED into synthetic challenges. No request_url argument: resource.url is not matched to the response URL, because that equality dropped payable offers when query strings, redirects, proxies, or port rewriting made the URLs differ (mppx #908). MPP.X402.Plug still binds the paid resource. | header: value |
synthetic? | 1 | Return true when a challenge was synthesized from a PAYMENT-REQUIRED offer. | challenge: value |
synthetic_id_prefix | 0 | Return the synthetic challenge-id prefix for x402 accepts. | - |
exact_intent | 0 | Return the MPP intent name used for synthetic x402 exact challenges. | - |
payment_method | 0 | Return the MPP method name used for synthetic x402 exact challenges. | - |
version | 0 | Return the x402 protocol version. | - |
Summary
Functions
Parse eip155:<id> into a positive chain id.
Parse a PAYMENT-REQUIRED header into synthetic MPP.Challenge structs.
MPP intent name used for synthetic x402 exact challenges.
Decode the Exact request object stored on a synthetic challenge.
MPP method name used for synthetic x402 exact challenges.
Return true when a challenge was synthesized from an x402 PAYMENT-REQUIRED offer.
Prefix for synthetic challenge IDs derived from PAYMENT-REQUIRED accepts.
x402 v2 protocol version.
Functions
@spec chain_id(String.t()) :: {:ok, pos_integer()} | {:error, atom()}
Parse eip155:<id> into a positive chain id.
@spec challenges_from_header(String.t()) :: {:ok, [MPP.Challenge.t()]} | {:error, atom()}
Parse a PAYMENT-REQUIRED header into synthetic MPP.Challenge structs.
Unsupported accepts (non-exact, non-EVM, Permit2) are dropped. An empty
remainder is {:ok, []}. There is no request_url argument: resource.url
is not compared to the response URL. That equality check dropped payable
offers when query strings, redirects, proxies, or port rewriting made the
two URLs differ (mppx #908). MPP.X402.Plug still rejects a credential
whose echoed resource does not match the server-bound URL.
@spec exact_intent() :: String.t()
MPP intent name used for synthetic x402 exact challenges.
@spec exact_request(MPP.Challenge.t()) :: {:ok, map()} | {:error, atom()}
Decode the Exact request object stored on a synthetic challenge.
@spec payment_method() :: String.t()
MPP method name used for synthetic x402 exact challenges.
Return true when a challenge was synthesized from an x402 PAYMENT-REQUIRED offer.
@spec synthetic_id_prefix() :: String.t()
Prefix for synthetic challenge IDs derived from PAYMENT-REQUIRED accepts.
@spec version() :: 2
x402 v2 protocol version.