Repository navigation
docs(x402): settle token, settle failure reasons and the new error codes (BAC-381) - #32
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…y code and status
This was referenced Oct 4, 2026
This branch was successfully deployed
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.
Part of BAC-381. Part of BAC-374.
The x402 pages catch up with the facilitator now in production,
@parallel-protocol/x4020.8.2 and@parallel-protocol/x402-fetch0.3.1.What changes
SETTLE_TIMEOUT, and.detail,.statusand.retryAfteronX402RuntimeError. The verify refusals gainINVALID_PAYLOAD,ASSET_MISMATCH,RECIPIENT_MISMATCHandSERVICE_UNAVAILABLE, andINSUFFICIENT_AMOUNTis defined as the amount the route guarantees the merchant. A new section lists the settlement failures: the402body withreasonandmessage, what the agent should do for each reason, and the one retry the SDK makes when the outcome is unknown.alreadySettledon a repeated settle, and a failed settlement that says why instead of inviting a retry.messageon the402of a refusal,alreadySettledon the confirmation, and the body of the402after a failed settlement.FacilitatorClientexample carries the settle token fromverifytosettleand reads the error's message and status. ThecreatePaymentGateexample settles withsettleVerifiedand answers a failure withsettlementFailureResponse. The settle token needs the SDK at 0.8.0 or later.Update after review
@parallel-protocol/x4020.7.x or earlier sees every settlement refused withSETTLE_TOKEN_REQUIRED. The pages recommend 0.8.2.INSUFFICIENT_BALANCEandWINDOW_TOO_LONG, settle reasonAMOUNT_MISMATCH, and the facilitator's HTTP status for every code.Retry-Afteris copied for any refusal that carries one.scheme,maxTimeoutSecondsandmeter, the settle amount header,amountSettled, andsettleVerified'samount. The concepts of metered payments are left to docs(x402): the settle token, one settlement per payment, metered payments, x402-fetch 0.3.0, x402 0.8.1 and CLI 0.4.1 #33.AUTHORIZATION_USED,PAYMENT_NOT_VERIFIED,PARALLELIZER_PAUSEDandSERVICE_UNAVAILABLE, say "Do not sign another payment before checking with the merchant", as@parallel-protocol/x4020.8.2 does.RELAYER_UNAVAILABLEgets its own row: its payment was not taken, and the facilitator will not settle it.INVALID_NONCEat verify asks for the same check, since the same payment reached the facilitator before.mainis merged in. The agent quickstart, the quickstart and the concepts page follow x402 0.8.2 and x402-fetch 0.3.1: the message x402-fetch gives for the reasons that leave the outcome open,INVALID_NONCEon a paid request, a settle answeredPARALLELIZER_PAUSEDorSERVICE_UNAVAILABLEwhile the first attempt may already have sent the transaction, and the versions to use.SUBMISSION_FAILEDasks for a check with the merchant, as x402-fetch says whatever the message, a settle replayed after a failed one getsPAYMENT_NOT_VERIFIED,X402ConfigErroris raised at the first request on a route for an unknown network or token,priceandmetermay return a Promise,INVALID_SETTLE_AMOUNTis listed,PARALLELIZER_PAUSEDandSERVICE_UNAVAILABLEget their own meaning, and the migration recipe says 0.8.2.Checked
#settlement-failures,#createpaymentgate,#settlement-routes,#metered-routes-upto) exist.@parallel-protocol/x4020.8.2 and@parallel-protocol/x402-fetch0.3.1, and the codes the facilitator returns.