Skip to main content
function fetchWithX402(options: FetchWithX402Options): FetchWithX402ReturnType;
Hook that provides a wrapped fetch function with payment handling.

Parameters

ParameterTypeDescription
optionsFetchWithX402OptionsConfiguration object for the fetch function

Returns

FetchWithX402ReturnType A wrapped fetch function with payment handling

Example

const { fetchWithPayment } = fetchWithX402();
const response = await fetchWithPayment("https://x402-resource.com", {
  method: "GET",
});