Legal Context Protocol

MPP Integration

Machine Payments Protocol integration — dedicated legalContext field in challenges, receipts, and sessions.

This section is advisory.

MPP (Machine Payments Protocol) is an open standard (IETF Internet-Draft, Apache 2.0), co-authored by Stripe and Tempo Labs. It enables machine-to-machine payments via HTTP 402 challenges, supporting stablecoins on Tempo, cards via Stripe, and Bitcoin via Lightning.

We recommend adding a dedicated legalContext field rather than overloading existing fields.


In the 402 Challenge (Proposal Phase)

WWW-Authenticate: Payment id="abc123", realm="api.example.com",
  method="tempo", intent="charge", request="eyJhb...",
  legalContext="lcp:url:https://example.com/terms/v3.pdf"

At Level 2+, the contentHash can be included:

legalContext="lcp:sha256:0x7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069"

Including the hash in the 402 challenge (proposal phase) allows the agent to verify terms before paying.

Note: MPP authenticates the 402 challenge via HMAC. Adding a legalContext parameter means it MUST be included in the HMAC computation; otherwise the client cannot verify challenge integrity. This requires a coordinated change to the MPP specification.


In the Payment Receipt (Execution Phase)

{
  "method": "tempo",
  "status": "success",
  "reference": "0x...",
  "timestamp": "2026-03-20T14:30:00Z",
  "legalContext": {
    "type": "sha256",
    "value": "0x7f83b165..."
  }
}

The receipt confirms the contentHash — what was agreed.

Note: The receipt JSON shown above is the decoded content. In the MPP flow, this is base64url-encoded and transmitted in the Payment-Receipt header.

Backward compatible — clients that do not understand legalContext ignore it. This change can be submitted upstream as a PR to the MPP specification.


MPP Sessions

MPP supports session-based streaming micropayments where an agent authorizes a spending limit upfront and streams payments against the session. For session-based payments, the legalContext SHOULD be included in the session establishment (the initial 402 challenge that creates the session) rather than in each individual streamed payment. All payments within a session are governed by the terms established at session creation.


TIP-20 Memo (32 Bytes)

The raw SHA-256 content hash can be placed directly in the TIP-20 memo field for on-chain binding. The 32-byte memo holds exactly one SHA-256 hash, providing an on-chain anchor tying the payment to specific terms. No type prefix — the field's purpose is defined by this integration guide.

Note: MPP's SDK auto-generates an attribution memo in the TIP-20 memo field only when no user-provided memo is present. Providing a contentHash as the memo replaces MPP's default attribution — this is the intended behavior for LCP-enabled transactions. The legalContext field in the receipt provides the same binding at the protocol level; the TIP-20 memo provides additional on-chain binding.