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

    How many times a call may be repeated after transport-level trouble, with exponential backoff. Default 2. A GET is re-sent after a network failure, timeout, HTTP 5xx or 429 (Paysafe's own SDKs retry GETs only). A write is never re-sent blindly, because Paysafe rejects a reused merchantRefNum (409/5031 under dupCheck) instead of answering with the original. A 429 is re-sent after backoff: Paysafe refused it unprocessed. After a timeout, network failure or 5xx the write is looked up by its merchantRefNum and the original returned when Paysafe has it. When it does not, a payment, capture or refund is not re-sent — the call fails with a non-retryable processing_error, to retry later with the same key — while a payment handle, verification or void, which move no money, are. Business errors (declines, 3406 unbatched settlement, validation) never repeat 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 exchange after this many milliseconds (default 60000, the response timeout of Paysafe's own SDKs, which warn that "some requests may take longer to process"). The timer covers the whole exchange including the response body read. A read that times out surfaces as a retryable psp_unavailable; a write that times out may still have been processed, so it is looked up by its merchantRefNum instead (see maxNetworkRetries).

    The bound is per exchange, and one call can make several: a read takes up to 1 + maxNetworkRetries attempts, a write up to 1 + maxNetworkRetries attempts with up to three lookups after an unanswered or duplicate one, and many calls read before they write (a card completion looks its key up, a refund reads the payment and its settlements, a full capture the payment and its settlement references). If Paysafe hangs on every exchange, a write can therefore take about (1 + maxNetworkRetries) × 4 × requestTimeoutMs, plus (1 + maxNetworkRetries) × requestTimeoutMs for each read before it: minutes at the defaults. On a platform that ends requests after 25-30 seconds, lower this and maxNetworkRetries until a call fits, and replay a call the platform ended with the same idempotencyKey: the replay reads back what the ended call did.

    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.