Make XGuard one-signature x402: no API key, no prepay, fee only after finality - #271
Draft
moelayyan90 wants to merge 48 commits into
Draft
Make XGuard one-signature x402: no API key, no prepay, fee only after finality#271moelayyan90 wants to merge 48 commits into
moelayyan90 wants to merge 48 commits into
Conversation
moelayyan90
force-pushed
the
agent/zero-friction-x402
branch
from
August 17, 2026 18:32
6574811 to
90f9449
Compare
moelayyan90
marked this pull request as ready for review
August 17, 2026 19:22
moelayyan90
marked this pull request as draft
August 17, 2026 22:43
moelayyan90
commented
Aug 17, 2026
moelayyan90
left a comment
Owner
Author
There was a problem hiding this comment.
Product-direction update: keep this PR as draft. The canonical XGuard model is now rail-embedded infrastructure, not merchant activation. Merchant signatures/accounts/API keys/prepay must not be required when a facilitator/payment rail embeds XGuard. Preserve this branch for reusable post-finality accounting and compatibility work, but do not merge it as the primary product path. The replacement architecture is tracked in draft PR #277.
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.
Product goal
Make the normal x402 seller path as close as possible to “use the service and XGuard takes a small disclosed share” without breaking the buyer-signed x402
exactpayment.Recommended seller flow
https://xguardgate.com/start.payTowallet and sign one short-lived activation message containing the exact XGuard pricing terms.HTTPFacilitatorClientathttps://xguardgate.com.The activation signature proves control of
payToand acceptance of the disclosed service terms. It does not authorize a token transfer and does not change the merchant payment recipient.Pricing in this PR
Default signed terms:
50bps) of an independently finalized successful merchant settlement$0.001per settlement$0$0$1.00The accepted pricing version, bps, cap and postpaid limit are persisted per activated
payTo; runtime config does not silently rewrite previously signed merchant terms.Why XGuard does not silently skim the buyer payment
x402
exactbinds the buyer-authorized recipient and amount. Reducing the merchant amount or rewritingpayTowould invalidate/alter the signed payment contract. XGuard therefore leaves the buyer payment exactly intact and records a separate postpaid service receivable only after independent finality proves success.Safety preserved / strengthened
FINALIZED,PENDING,PROVEN_FAILED,CONFLICTtruth statesAccounting changes
Adds migration
0016_zero_friction_postpaid.sqlfor:Zero-friction fees are calculated from the independently finalized settlement amount and the merchant’s stored signed terms. Failures and ambiguity create no fee hold/refund cycle.
Compatibility
Legacy API-key/prepaid universal-gateway endpoints remain available for existing clients but are no longer the recommended x402 seller path.
Documentation / machine contract
README, Quickstart, Pricing, Billing, API docs, facilitator policy, Distribution, OpenAPI, costs, unit economics and the documentation quality gate are updated so tooling cannot silently regress the primary x402 path back to API-key/prepaid onboarding.
Release requirement
Do not merge unless
verify:release, Payment Security, CodeQL and protected-branch checks are green. Apply D1 migrations before/with the mainnet Worker deployment and verify/start, the payment manifest,/supported,/verify,/settleand settlement-truth surfaces after deployment.