Agent Legal Context
Protocol Integration

x402 Integration

x402 integration via response header and payment metadata.

This section is advisory.

x402 uses HTTP 402 responses to negotiate payments. Legal context can be included in the response header and in payment metadata.


Response Header

X-ALC-Hash: 0x7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069

The X-ALC-Hash header carries the content hash in the 402 response (proposal phase). The agent can verify the terms before proceeding with payment.


Payment Metadata

In payment metadata, use the alc: prefix format:

alc:sha256:0x7f83b165...

Integration Flow

  1. Service returns 402 with X-ALC-Hash header containing the contentHash
  2. Agent fetches the terms document from the URL known via /.well-known/legal-context.json (discovered earlier)
  3. Agent computes SHA-256 of the downloaded document and compares to the X-ALC-Hash value
  4. If match, agent saves the document locally and proceeds with payment
  5. Resource delivered with the same hash reference in the receipt