x402 icon indicating copy to clipboard operation
x402 copied to clipboard

x402.org /protected returns a json object in the error field

Open straumat opened this issue 2 months ago • 0 comments

When calling https://www.x402.org/protected with an invalid payment, according to the specs, the error field should contain an error message (Optional error message indicating why payment is required) but I'm getting a JSON object:

"error": {
    "issues": [
      {
        "code": "invalid_union",
        "unionErrors": [
          {
            "issues": [
              {
                "code": "invalid_type",
                "expected": "string",
                "received": "undefined",
                "path": [
                  "payload",
                  "signature"
                ],
                "message": "Required"
              }
            ],
            "name": "ZodError"
          },
          {
            "issues": [
              {
                "code": "invalid_type",
                "expected": "string",
                "received": "undefined",
                "path": [
                  "payload",
                  "transaction"
                ],
                "message": "Required"
              }
            ],
            "name": "ZodError"
          }
        ],
        "path": [
          "payload"
        ],
        "message": "Invalid input"
      }
    ],
    "name": "ZodError"
  }

I don't see anything about it in the specs, documentation or the code. Is it part of the specs ?

I'm using https://www.x402.org/protected to develop an x402 java sdk, that's why I'm testing all replies to be sure I reply the same way than you do.

straumat avatar Oct 31 '25 16:10 straumat