satim-module - v1.0.0
    Preparing search index...

    Interface WebhookHandlerOptions

    interface WebhookHandlerOptions {
        onResolveAmount: (
            orderId: string,
        ) => number | Promise<number | null | undefined> | null | undefined;
        onCheckDuplicate?: (orderId: string) => boolean | Promise<boolean>;
        onMarkProcessed?: (orderId: string) => void | Promise<void>;
        maxCallbacksPerWindow?: number;
        rateLimitWindowMs?: number;
        suppressMultiInstanceWarning?: boolean;
    }
    Index

    Properties

    onResolveAmount: (
        orderId: string,
    ) => number | Promise<number | null | undefined> | null | undefined

    Resolve the expected major-unit amount for an orderId. Typically a database lookup keyed by the orderId your application stored at registration time.

    Return undefined / null to reject the callback as referencing an unknown order — verify() will return null without calling the gateway.

    onCheckDuplicate?: (orderId: string) => boolean | Promise<boolean>

    Check whether orderId has already been processed.

    For multi-instance deployments, MUST implement check-and-mark as a single atomic operation (Redis SETNX, database INSERT … ON CONFLICT DO NOTHING). The handler's own in-flight lock only serialises within a single Node.js process.

    Default (single-process only): in-memory Set.

    onMarkProcessed?: (orderId: string) => void | Promise<void>

    Mark orderId as processed.

    Called after confirm() returns a non-pending response. Pending orders are deliberately not marked so subsequent callbacks can re-check as the order advances to a terminal state.

    maxCallbacksPerWindow?: number

    Max admitted callbacks per sliding window. Default 100.

    rateLimitWindowMs?: number

    Sliding window duration in ms. Default 60 000.

    suppressMultiInstanceWarning?: boolean

    Suppress the construction-time console.warn that fires when the in-memory duplicate fallback is in use. Set to true only after confirming single-process deployment.