Conversation
A verify or settle call that fails without the facilitator's own response (network error, non-x402 error body) was reported as 402, which buyers read as a definite rejection although a settle may have reached the chain. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
🦋 Changeset detectedLatest commit: b5068d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
radiusPaymentsanswers502(facilitator_error) when a verify, settle or/supportedcall fails without the facilitator's own answer.Problem:
@x402/coreturns any facilitator error other thanFacilitatorResponseErrorinto a402: a dropped connection, or an error page (e.g. a gateway504) instead of an x402 body. Settling before the handler (the default), it even comes back as a fresh challenge. A buyer reads402as "rejected, nothing moved", but the settle may have reached the chain, so paying again can charge twice.Change:
withUnknownOutcomes(hono/facilitator.ts) wraps the facilitator, built-in or self-hosted. It rethrows those failures asFacilitatorResponseError, which core passes through and the middleware maps to502.VerifyErrorandSettleError(the facilitator's own answers) still give402. A rejected API key at/supportedis now502rather than500.Verified: 5 new tests in
hono.test.ts: an error page at settle, a failed connection,settle: 'after'at settle and at verify, and a facilitator rejection staying402. The four502cases fail without the wrapper. 135 SDK and 31 CLI tests pass; typecheck and build pass.Makes the recovery policy in dev-docs #129 (
502= outcome unknown,402= no money moved) true.🤖 Generated with Claude Code