Skip to content

Add x402Version field to all protocol messages #4

Description

@andreabadesso

Current behavior

Our 402 response does not include an x402Version field:

{
  "accepts": [...],
  "version": "1"
}

The version field is our own; it's not the x402 protocol version.

Required behavior

Add x402Version: 2 to:

  1. 402 response (PAYMENT-REQUIRED): Top-level field in the response body
  2. PAYMENT-SIGNATURE header: Include in the payment payload
  3. PAYMENT-RESPONSE header: Include in the settlement result
{
  "x402Version": 2,
  "accepts": [...],
  "version": "1"
}

Changes needed

Resource server (resource-server.js)

  • Add x402Version: 2 to the 402 JSON response

Client (client.js) and dApp (dapp/components/X402Fetch.tsx)

  • Include x402Version: 2 in the payment payload

Facilitator (facilitator.js)

  • Include x402Version: 2 in verify/settle responses

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions