docs(x402): fix gasless upto setup and v2 header names (verified e2e)#14
Merged
Conversation
Found via real end-to-end runs against the public Sepolia facilitator (0-ETH buyer paying gasless `upto`): - Seller quickstart omitted `declareEip2612GasSponsoringExtension()` on the `upto` route. Without it the facilitator can't sponsor the buyer's Permit2 approval, so a 0-ETH buyer is rejected with `permit2_allowance_required` once its standing allowance is exhausted. Add the extension + explanation, and add `@x402/extensions` to install/package list. - Header names were the x402 v1 spelling. This (v2) SDK uses `payment-response` (receipt), `payment-signature` (request), `payment-required` (402). Fix the buyer receipt code, the how-it-works diagram/text, and prose across pages. - Soften the `receipt.amount` note (it is optional in SettleResponse).
Verified e2e against the public Sepolia facilitator with a 0-ETH buyer: both `exact` and `upto` settle on-chain while the buyer's ETH stays 0 — the facilitator submits settlement and pays the gas. The previous wording claimed `exact` needs buyer ETH and only `upto` could be gasless; that is backwards. Correct the Buyers prerequisites/intro and the Networks & Token funding section: the buyer needs no ETH for `exact`, and none for `upto` when the seller enables EIP-2612 sponsoring (only a non-sponsored upto's one-time Permit2 approval costs the buyer a little ETH).
…ippet - how-it-works: state that the facilitator relays settlement and pays gas for `exact` (buyer needs no ETH), and that `upto`'s only extra cost is the one-time Permit2 approval, sponsored when the seller enables it. Keeps the scheme overview consistent with the Buyers/Networks guidance. - sellers: note the "Accepting upto" snippet replaces the step-4 route and reuses the same `price` / `PAY_TO`.
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.
Follow-up to #13. These fixes were found by running the documented Quickstart: Sellers and Quickstart: Buyers code verbatim against the public HPP Sepolia facilitator (a 0-ETH buyer paying gasless
upto).Bug 1 — Seller quickstart omitted the gasless extension
The
uptoroute did not declaredeclareEip2612GasSponsoringExtension(). Without it the facilitator can't sponsor the buyer's Permit2 approval, so a 0-ETH buyer is rejected withpermit2_allowance_requiredonce its standing allowance is exhausted (reproduced: allowance9951 < 10000→ 412; after adding the extension → settles).uptoand gasless payments"@x402/extensionsto install line and the SDK package table:::noteon the Facilitator pageBug 2 — v1 header names
The docs used the x402 v1 header spelling. This (v2) SDK uses:
payment-signature(docs saidX-PAYMENT)payment-response(docs saidX-PAYMENT-RESPONSE)payment-requiredThe buyer's receipt code read
x-payment-response, so it never fired. Fixed the buyer code, the how-it-works diagram/text, and prose across pages. Also softened thereceipt.amountnote (it is optional inSettleResponse).Verification
After the fixes, the documented buyer code returns
200and prints the receipt:SETTLED tx: 0xb8cdc6f3…34f4 network: eip155:181228, with the buyer's USDC.e balance decreasing on-chain — all gasless (buyer holds 0 ETH).npm run buildpasses with `onBrokenLinks: 'throw'`.