PayFanout API reference
    Preparing search index...

    Interface TransportRequestOptions

    REST transport primitives shared by the fetch-based server adapters. These are deliberately NOT a client: authentication, request envelopes, and error mapping stay in each adapter — only the transport mechanics (one timeout covering headers AND body, transient-only retries with backoff, tolerant JSON parsing) live here.

    interface TransportRequestOptions {
        fetch: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        onFailure: (timedOut: boolean, cause: unknown) => Error;
        signal?: AbortSignal;
        timeoutMs: number;
    }
    Index
    fetch: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

    The fetch to use — adapters expose an injectable config.fetch for tests.

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | URL | Request, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optionalinit: RequestInit

        Returns Promise<Response>

    onFailure: (timedOut: boolean, cause: unknown) => Error

    Builds the error thrown on transport failure. timedOut is true when the exchange was aborted (timeout or external signal) rather than failing on its own — adapters use it to keep their exact user-facing messages ("X did not respond within Nms." vs "Could not reach X.").

    signal?: AbortSignal

    Optional external cancellation, linked to the same internal abort.

    timeoutMs: number

    Abort the whole exchange after this many milliseconds. The timer stays armed until the BODY is read — a response can stall after its headers arrive, and response.text() would otherwise wait forever.