View as Markdown

SDK reference · Rails

intentPaymentFetch

intentPaymentFetch in @provenanceauth/rails/x402, Rails. Client middleware: wrap a fetch so a 402 that asks for a Provenance intent is retried once with a PAYMENT-SIGNATURE carrying the payment and the token.

Signature

intentPaymentFetch(fetchImpl: typeof fetch, getToken: (challenge: X402IntentChallenge) => Promise<string | null> | string | null, opts: IntentPaymentFetchOptions): typeof fetch

Parameters

fetchImpltypeof fetchRequired
getToken(challenge: X402IntentChallenge) => Promise<string | null> | string | nullRequired
optsIntentPaymentFetchOptionsRequired

Returns

typeof fetch

HTTP operation

Runs locally, with no request to the API.

Was this page helpful? Send us feedback

LLM? Read llms.txt.