PayFanout API reference
    Preparing search index...

    Interface PaysafeServerAdapterConfig

    interface PaysafeServerAdapterConfig {
        baseUrl?: string;
        environment: "sandbox" | "live";
        fetch?: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        maxNetworkRetries?: number;
        merchantAccountResolver: (
            currency: string,
            country?: string,
        ) => string | undefined;
        now?: () => number;
        password: string;
        paymentMethods?: PaymentMethodCapability[];
        requestTimeoutMs?: number;
        sessionSigningKey: string;
        sessionTtlSeconds?: number;
        sleep?: (ms: number) => Promise<void>;
        username: string;
        webhookHmacKey: string | string[];
    }
    Index
    baseUrl?: string
    environment: "sandbox" | "live"

    Explicit, never inferred. sandbox -> api.test.paysafe.com, live -> api.paysafe.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>

    maxNetworkRetries?: number

    Automatic retries for transport-level trouble only (network failure, timeout, HTTP 5xx, 429) with exponential backoff. Default 2. Safe because merchantRefNum makes every mutating call idempotent. Business errors (declines, 3406 unbatched-settlement, validation) are NEVER retried here.

    merchantAccountResolver: (
        currency: string,
        country?: string,
    ) => string | undefined

    Paysafe selects a merchant account per currency/country — a single hardcoded id is wrong. This is also why CreatePaymentSessionInput carries country. Return undefined for single-account API keys: Paysafe then routes by key + currency without an explicit accountId.

    now?: () => number

    Injected clock (ms since epoch) for session-TTL tests.

    password: string
    paymentMethods?: PaymentMethodCapability[]

    Account capabilities vary by merchant account/currency/country — override instead of trusting defaults. Defaults are conservative.

    requestTimeoutMs?: number

    Abort a hung Paysafe connection after this many milliseconds (default 30000). The timer covers the whole exchange including the response body read. Every mutating call carries an idempotent merchantRefNum, so a timed-out request is safe to retry. Timeouts surface as retryable psp_unavailable errors.

    sessionSigningKey: string

    HMAC key for the stateless signed session context (see session-context.ts).

    sessionTtlSeconds?: number

    How long a signed session context stays completable, in seconds. Default 3600 (1h). A signed token must not be valid forever — expiry is enforced at completePayment/verifyPaymentMethod/updatePaymentSession.

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

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

    username: string

    Basic-auth API credentials (server-side only).

    webhookHmacKey: string | string[]

    HMAC key Paysafe uses to sign webhook payloads. Accepts several keys at once so a rotation needs no cutover — any active key verifying wins.