Expand description
HTTP header encoding and decoding for x402 protocol messages.
Handles Base64-encoded JSON payloads in PAYMENT-SIGNATURE,
PAYMENT-REQUIRED, PAYMENT-RESPONSE, and legacy X-PAYMENT headers.
Corresponds to Python SDK’s http/x402_http_client_base.py.
Functions§
- decode_
payment_ payload - Decodes a
PAYMENT-SIGNATUREorX-PAYMENTheader value into a version-tagged payload enum. - decode_
payment_ required - Decodes a
PAYMENT-REQUIREDheader value into a version-tagged enum. - decode_
payment_ response - Decodes a
PAYMENT-RESPONSEheader value into aSettleResponse. - encode_
payment_ required - Encodes a
PaymentRequired(V2) as a Base64 string for thePAYMENT-REQUIREDheader. - encode_
payment_ required_ v1 - Encodes a
PaymentRequiredV1as a Base64 string for thePAYMENT-REQUIREDheader (V1). - encode_
payment_ response - Encodes a
SettleResponseas a Base64 string for thePAYMENT-RESPONSEheader. - encode_
payment_ signature - Encodes a V2
PaymentPayloadas a Base64 string for thePAYMENT-SIGNATUREheader. - encode_
x_ payment - Encodes a V1
PaymentPayloadV1as a Base64 string for theX-PAYMENTheader.