Skip to content

docs(x402): settle token, settle failure reasons and the new error codes (BAC-381) - #32

Merged
JeanBrasse merged 6 commits into
mainfrom
docs/x402-settle-token
Oct 7, 2026
Merged

JeanBrasse merged 6 commits into
mainfrom
docs/x402-settle-token

Conversation

@Joh077

@Joh077 Joh077 commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Part of BAC-381. Part of BAC-374.

The x402 pages catch up with the facilitator now in production, @parallel-protocol/x402 0.8.2 and @parallel-protocol/x402-fetch 0.3.1.

What changes

  • Error codes: the SDK's SETTLE_TIMEOUT, and .detail, .status and .retryAfter on X402RuntimeError. The verify refusals gain INVALID_PAYLOAD, ASSET_MISMATCH, RECIPIENT_MISMATCH and SERVICE_UNAVAILABLE, and INSUFFICIENT_AMOUNT is defined as the amount the route guarantees the merchant. A new section lists the settlement failures: the 402 body with reason and message, what the agent should do for each reason, and the one retry the SDK makes when the outcome is unknown.
  • Verify / settle flow: the sequence shows the settle token going from verify to settle. The guarantees add the settle bound to the merchant that verified, one settlement per payment with alreadySettled on a repeated settle, and a failed settlement that says why instead of inviting a retry.
  • Schemas: message on the 402 of a refusal, alreadySettled on the confirmation, and the body of the 402 after a failed settlement.
  • API reference: the FacilitatorClient example carries the settle token from verify to settle and reads the error's message and status. The createPaymentGate example settles with settleVerified and answers a failure with settlementFailureResponse. The settle token needs the SDK at 0.8.0 or later.

Update after review

  • The settle token is required since 1 October 2026: a merchant on @parallel-protocol/x402 0.7.x or earlier sees every settlement refused with SETTLE_TOKEN_REQUIRED. The pages recommend 0.8.2.
  • Verify codes INSUFFICIENT_BALANCE and WINDOW_TOO_LONG, settle reason AMOUNT_MISMATCH, and the facilitator's HTTP status for every code. Retry-After is copied for any refusal that carries one.
  • The 13 settlement routes, A to L and U, with what each needs on the chain.
  • Metered routes in the API reference: scheme, maxTimeoutSeconds and meter, the settle amount header, amountSettled, and settleVerified's amount. 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.
  • x402 0.8.1: the facilitator URL must use https and redirects are never followed. Rate limits as the agent sees them.
  • The four settlement reasons that may still pay the merchant, AUTHORIZATION_USED, PAYMENT_NOT_VERIFIED, PARALLELIZER_PAUSED and SERVICE_UNAVAILABLE, say "Do not sign another payment before checking with the merchant", as @parallel-protocol/x402 0.8.2 does. RELAYER_UNAVAILABLE gets its own row: its payment was not taken, and the facilitator will not settle it. INVALID_NONCE at verify asks for the same check, since the same payment reached the facilitator before.
  • The retry the SDK makes after a lost answer: the facilitator answers the recorded outcome once the first attempt has finished, and any other answer tells the agent to check with the merchant. The per-IP settle limit can answer that retry while the first attempt has settled.
  • main is 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_NONCE on a paid request, a settle answered PARALLELIZER_PAUSED or SERVICE_UNAVAILABLE while the first attempt may already have sent the transaction, and the versions to use.
  • SUBMISSION_FAILED asks for a check with the merchant, as x402-fetch says whatever the message, a settle replayed after a failed one gets PAYMENT_NOT_VERIFIED, X402ConfigError is raised at the first request on a route for an unknown network or token, price and meter may return a Promise, INVALID_SETTLE_AMOUNT is listed, PARALLELIZER_PAUSED and SERVICE_UNAVAILABLE get their own meaning, and the migration recipe says 0.8.2.

Checked

  • 350 tests and the site build pass.
  • The built pages carry the new codes, and the anchors the pages link to (#settlement-failures, #createpaymentgate, #settlement-routes, #metered-routes-upto) exist.
  • The tables match the READMEs published with @parallel-protocol/x402 0.8.2 and @parallel-protocol/x402-fetch 0.3.1, and the codes the facilitator returns.

@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs-parallel Ready Ready Preview Oct 5, 2026 3:15pm UTC
parallel-docs Ready Ready Preview Oct 5, 2026 3:15pm UTC

This branch was successfully deployed

2 active deployments
Preview – docs-parallel — 60b699f4 Deployed Oct 5, 2026 by vercel[bot]
Preview – parallel-docs — 60b699f4 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants