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 fetchParameters
fetchImpltypeof fetchRequiredgetToken(challenge: X402IntentChallenge) => Promise<string | null> | string | nullRequiredoptsIntentPaymentFetchOptionsRequired
Returns
typeof fetch
HTTP operation
Runs locally, with no request to the API.