# 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

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

## Parameters

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

## Returns

`typeof fetch`

Runs locally, with no request to the API.
