Repository navigation
docs(x402): add a guide for adding Celo to an existing endpoint - #2420
Open
artugrande wants to merge 2 commits into
Open
artugrande wants to merge 2 commits into
artugrande wants to merge 2 commits into
Conversation
Covers the Celo offers and second facilitator, the buy quote self-check, keeping an upstream API key on the server, and the exact errors a seller coming from another network hits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
viral-sangani
requested changes
Nov 2, 2026
viral-sangani
left a comment
Collaborator
There was a problem hiding this comment.
nice guide, Celo setup checks out. 2 things before merge:
- L46: put the Celo facilitator first, SDK picks the first match so the existing one can grab Celo payments
- L35: rebuilding the existing client from its URL drops
createAuthHeaders, tell people to reuse their configured client
nits: list tested versions on the page (L26), say to replace the old /rates handler (L107), and change "well formed" to "matches Buy's network/token/scheme" (L99)
…ient - The resource server uses, for each network, the first facilitator that supports it, so a facilitator that also lists Celo and comes first takes the Celo payments. The example puts the Celo one first, and Troubleshooting has the symptom. - The existing facilitator line says to reuse the configured client, since rebuilding it from its URL drops createAuthHeaders. - Tested versions, the upstream handler replacing the /rates one, and what a "yes" from buy quote checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks @viral-sangani, all addressed in fb3b8fa:
|
viral-sangani
approved these changes
Nov 4, 2026
viral-sangani
left a comment
Collaborator
There was a problem hiding this comment.
all addressed, thanks. heads up #2425 touches the same docs.json / overview / ai-resources lines, so whoever merges second needs a small rebase
This was referenced Nov 4, 2026
This branch has not been 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.
The hole, and the fix
The x402 pages explain how to start selling on Celo, but not how to add Celo to an endpoint that already sells on another network. That seller has a few Celo-specific ways to fail: one facilitator configured instead of two, the EIP-712
extra.namecopied from another network, the dashboard host used as the facilitator URL.This PR adds
build/agents/x402-add-celo.mdx, a guide for that seller:npx @celo/buy quote, which needs no wallet and signs nothing.The page is in the nav, listed on
/build/agents/overviewand/build/agents/ai-resources(AGENTS.md section 8), and linked fromRelatedon both x402 pages.What this does NOT do / residual risk
No real mainnet settlement has run against this example yet. The paid flow below used fake facilitators, so nothing proves settlement throughA real USDC payment settled throughapi.x402.celo.orgwith this exact code. I'll post the transaction hash here before this merges.api.x402.celo.org, see0x125121df...under Verification evidence.buy quote, not settled. USDC, USDT and USA₮ use the same EIP-3009 path, but a domain problem specific to those two offers would only show on a real payment.mint dev.mint broken-linkspasses, and it does not validate anchors, so I checked those by hand.Judgement calls
Issues
Refs none.
Stacking / conflicts
Branched off current
main, independent of other open PRs.build/agents/x402.mdxandx402-get-discovered.mdxonly gain a line underRelated.Verification evidence
Run with
@x402/express,@x402/core,@x402/evmand@x402/fetch2.29.0, Node 22. Thetsblocks were extracted from the page, with onlypayToand the port replaced.tsc --noEmit --stricton both blocks: passes.GET /rateswith the Celo facilitator and PayAI as the existing one:402, and the decoded header carries the Base and three Celo offers.BUY_HOME=$(mktemp -d) npx @celo/buy quote <url> --token USDC|USDT|USAT(0.8.5, empty home):payable yes — matches --token X on celofor each.200X-API-Key502200tsblock withpayTofrom an env var and port 3010, paid withnpx @celo/buy curl --token USDC --max-amount 0.01(0.8.5): HTTP 200,0x125121dff7d31875431ef81319b5729f0c5eead5b6b413b8ce37503a772a1c4d, block 81637407, status success. The USDCTransferis 0.01 from the buyer to thepayToaddress. The transaction sender is0x0d74D5Cefd2e7F24E623330ebE3d8D4cB45fFB48, the signer/supportedlists for the facilitator, and the buyer holds 0 CELO.invalid_exact_evm_payload_signatureandinsufficient_fundscame from the live/verifywith an unfunded throwaway key.Facilitator does not support scheme...,Facilitator supported returned invalid JSON, the EIP-712 parameters error and the v1buy quoteline came from running each misconfiguration. The401row is taken from the x402 page.eth_call:name()returnsUSDC,Tether USD,Tether America USD,decimals()returns 6 for all three, all EIP-55 valid.npx mint broken-links:success no broken links found.Remaining ops steps
x402-get-discovered.mdxQuestions for the maintainer
@szapelao two things I found on
x402.mdxwhile testing, left out of this PR since they're separate changes:price: "$0.01"throwsNo default asset configured for network eip155:42220looks out of date. With@x402/evm2.29.0 the shorthand works on Celo: the 402 is served and the payment reaches the facilitator, and the package's default-asset table haseip155:42220with USDC first. Should the warning go, or say which version fixed it?{}body. On 2.29.0 the body is{"error":"Payment required"}.Happy to send a small PR for both.
🤖 Generated with Claude Code