CreateHttpFacilitatorParams
このコンテンツはまだ日本語訳がありません。
Defined in: src/x402/facilitator.ts:745
Parameters for createHttpFacilitator.
Properties
baseUrl
readonlybaseUrl:string
Defined in: src/x402/facilitator.ts:752
Base URL of the facilitator service (Coinbase CDP, your own host, any
x402 v2-compliant endpoint). Endpoints /verify, /settle, /supported
are POST / POST / GET respectively relative to this URL. Trailing slash
is stripped.
fetch?
readonlyoptionalfetch?: (input,init?) =>Promise<Response>
Defined in: src/x402/facilitator.ts:765
Override the global fetch (e.g. for in-process testing or to inject
an undici Agent in Node).
Parameters
input
string | URL | Request
init?
RequestInit
Returns
Promise<Response>
getAuthHeaders?
readonlyoptionalgetAuthHeaders?: (endpoint) =>Record<string,string> |Promise<Record<string,string>>
Defined in: src/x402/facilitator.ts:758
Optional callback invoked per request that returns headers to merge
into the outbound request (typically Authorization). Receives the
endpoint name so the caller can compute distinct signatures per route.
Parameters
endpoint
"verify" | "settle" | "supported"
Returns
Record<string, string> | Promise<Record<string, string>>
retry?
readonlyoptionalretry?:false|X402FacilitatorRetryOptions
Defined in: src/x402/facilitator.ts:790
Resend a request with the SAME body when the facilitator could not take
it. Retry-After (seconds or an HTTP date) is honoured; otherwise the wait
starts at initialDelayMs and doubles. No attempt is started whose wait
would overrun budgetMs.
/verify(moves no funds) is resent after HTTP 502 / 503 / 504, a network error, or atimeoutMstimeout./settleis resent only after a 503 (the facilitator declining the request) or when nothing was sent (a refused connection, an unresolved host). After a 502 / 504, a dropped connection or a timeout the first attempt may already have broadcast, so it is not resent. And because a proxy can answer 503 after forwarding, a failure answered after a resend is not trusted as final either. Every such case throws X402SettleOutcomeUnknownError: the payment may still land.
Resending can never charge twice: the body carries the same signed
authorization, and EIP-3009 spends its nonce once on chain. Other statuses
(4xx, 500) are not resent: a /verify one throws; a /settle one is the
answer if its body is a settle response, and an unknown outcome if not.
On by default ({ maxAttempts: 3, budgetMs: 10_000, initialDelayMs: 500 });
false sends each request once.
timeoutMs?
readonlyoptionaltimeoutMs?:number
Defined in: src/x402/facilitator.ts:797
Abort an attempt that has not answered within this many milliseconds.
Absent: no timeout. A /verify that times out throws
X402FacilitatorTimeoutError; a /settle that times out throws
X402SettleOutcomeUnknownError (caused by it) — unknown, not failed.