You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a tracked implementation design for a time-boxed x402 access pass for Token API.
Instead of charging every API query as a separate x402 settlement, Token API should support a $0.10 x402 payment that grants 1 hour of Pro-like access. This is intended to make x402 economically practical for very low-cost Token API requests where per-request facilitator fees/gas economics could exceed the endpoint price.
The exact fields should follow what the x402/CDP libraries expose, but the important properties are:
stable receipt/cache key
payer identity
network/rail
payment amount
resource/pass type
facilitator-confirmed settled timestamp
expiry timestamp
plan/limit tier
Multi-container / restart behavior
In-memory state is only a cache, not the long-term authority.
If the container restarts or a different container handles the next request:
The local cache may not contain the receipt.
Token API should attempt to refetch/revalidate the payment from the facilitator.
If CDP supports already-settled receipt lookup or replay-safe verification, Token API should rebuild the memory cache and continue access.
If CDP does not support this, the first implementation may require sticky sessions or a future shared-state layer such as Redis.
This needs to be validated during implementation because replaying an already-settled x402 payment through the normal settle path may be rejected or may not be the intended API flow.
Security requirements
Do not trust client-provided timestamps.
Expiry must be based on facilitator-confirmed settlement time or a server-confirmed first-seen settlement time.
Do not key access only by timestamp or wallet address.
Bind the receipt to the resource/pass type: token-api-pro-1h.
Bind the receipt to payer/network/pay-to/amount where possible.
Do not call settle again for known valid in-memory receipts.
Ensure a receipt for another resource cannot unlock Token API.
Ensure a receipt under $0.10 cannot unlock the pass.
Continue applying Pro-like limits/rate limits per request.
Prevent public cache leakage for x402-paid responses.
Implementation notes
Likely modules/files:
src/config.ts
x402 enablement and pass configuration
X402_PASS_PRICE_USD=0.10
X402_PASS_DURATION_SECONDS=3600
src/x402/accessPass.ts
memory cache
receipt parsing/keying
expiry checks
src/x402/facilitator.ts
CDP verify/settle/refetch wrapper
src/middleware/x402AccessPass.ts
enforce pass on paid routes
set trusted internal plan marker for Pro-like validation
repeated request with same receipt uses memory cache
expired receipt returns 402
cache miss calls facilitator fallback
underpaid/wrong-resource receipts are rejected
free routes bypass x402
x402 pass applies Pro-like limits
Open implementation question
Confirm CDP facilitator behavior for an already-settled payment proof:
Is there a receipt/status lookup endpoint or SDK method?
Can the same payment completion be replayed for verification without settling again?
If replayed after settlement, does the facilitator return a useful settled receipt or reject it as already used?
The answer determines whether in-memory cache plus facilitator fallback is enough for multi-container/restart behavior, or whether sticky sessions/shared state are required.
Detailed description
Add a tracked implementation design for a time-boxed x402 access pass for Token API.
Instead of charging every API query as a separate x402 settlement, Token API should support a
$0.10x402 payment that grants 1 hour of Pro-like access. This is intended to make x402 economically practical for very low-cost Token API requests where per-request facilitator fees/gas economics could exceed the endpoint price.This issue is a follow-up/sub-scope of:
Proposed behavior
First paid request / pass creation
402 Payment Requiredfor a$0.10 / 1 hourToken API access pass.0x49D581486438aAD93f4114084Ac5B09A8b7C9685EpRR35QnB5PfTczy3j5rp9bCw4NKzHkd8S1ubdza4my9https://api.cdp.coinbase.com/platform/v2/x402Subsequent requests within 1 hour
The agent/client should keep sending the same payment completion/proof/receipt reference with each request.
Token API should:
402 Payment Required.In-memory state model
For v1, use in-process memory only. Do not introduce Redis or another shared datastore yet.
Suggested record shape:
The exact fields should follow what the x402/CDP libraries expose, but the important properties are:
Multi-container / restart behavior
In-memory state is only a cache, not the long-term authority.
If the container restarts or a different container handles the next request:
This needs to be validated during implementation because replaying an already-settled x402 payment through the normal settle path may be rejected or may not be the intended API flow.
Security requirements
token-api-pro-1h.settleagain for known valid in-memory receipts.$0.10cannot unlock the pass.Implementation notes
Likely modules/files:
src/config.tsX402_PASS_PRICE_USD=0.10X402_PASS_DURATION_SECONDS=3600src/x402/accessPass.tssrc/x402/facilitator.tssrc/middleware/x402AccessPass.tssrc/x402/routes.tsTesting targets:
402402Open implementation question
Confirm CDP facilitator behavior for an already-settled payment proof:
The answer determines whether in-memory cache plus facilitator fallback is enough for multi-container/restart behavior, or whether sticky sessions/shared state are required.