PayFanout API reference
    Preparing search index...

    Interface PayPalServerAdapterConfig

    interface PayPalServerAdapterConfig {
        baseUrl?: string;
        brandName?: string;
        cancelUrl?: string;
        clientId: string;
        clientSecret: string;
        environment: "sandbox" | "live";
        fetch?: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        locale?: string;
        maxNetworkRetries?: number;
        now?: () => number;
        requestTimeoutMs?: number;
        returnUrl?: string;
        sleep?: (ms: number) => Promise<void>;
        userAction?: "CONTINUE" | "PAY_NOW";
        webhookId?: string;
    }
    Index
    baseUrl?: string
    brandName?: string

    Shown instead of the business name in the PayPal window.

    cancelUrl?: string

    Where PayPal sends the buyer on cancel; defaults to the return URL.

    clientId: string

    REST app client id (the same value the browser SDK uses — public).

    clientSecret: string

    REST app secret — server-side only, authenticates the client id.

    environment: "sandbox" | "live"

    Explicit, never inferred. sandbox -> api-m.sandbox.paypal.com, live -> api-m.paypal.com.

    fetch?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

    Injected 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>

    locale?: string

    BCP-47 checkout locale (e.g. "fr-FR"); PayPal auto-detects when omitted.

    maxNetworkRetries?: number

    Automatic retries for transport-level trouble only (network failure, timeout, HTTP 5xx, 429) with exponential backoff. Default 2. Safe because retries reuse the same PayPal-Request-Id — PayPal's own guidance for a 5xx on /capture. Business errors (declines, 422 state errors) are NEVER retried here.

    now?: () => number

    Injected clock (ms since epoch) for OAuth-cache tests.

    requestTimeoutMs?: number

    Abort a hung PayPal connection after this many milliseconds (default 30000). The timer covers the whole exchange including the response body read. Mutating calls carry a deterministic PayPal-Request-Id, so a timed-out request is safe to retry. Timeouts surface as retryable psp_unavailable errors.

    returnUrl?: string

    Fallback approval return URL when the session input carries none.

    sleep?: (ms: number) => Promise<void>

    Injected backoff sleep for retry tests; defaults to a real setTimeout.

    userAction?: "CONTINUE" | "PAY_NOW"

    Label on the popup's final button. Default "CONTINUE": the popup approves and control returns to the page, where PayFanout's own Pay button completes the payment (PAY_NOW belongs to flows that capture on approval). The client adapter's userAction (the SDK's commit param) must agree.

    webhookId?: string

    The webhook id PayPal assigned when the listener URL was registered. Required for webhook verification — verifyWebhookSignature returns false without it (verification postbacks need it, fail closed).