Better Payment 0.11.1 API
    Preparing search index...

    Interface IdempotencyStore

    Key-value store used by the HTTP handler to process each callback once and to honor Idempotency-Key headers. Values are JSON strings.

    Implementations must make setIfAbsent atomic (Redis SET key value NX EX ttl, a unique-key insert in SQL). With several app instances, use a shared store: the in-memory default only deduplicates within one process.

    interface IdempotencyStore {
        delete(key: string): void | Promise<void>;
        get(key: string): string | Promise<string | undefined> | undefined;
        set(key: string, value: string, ttlSeconds: number): void | Promise<void>;
        setIfAbsent(
            key: string,
            value: string,
            ttlSeconds: number,
        ): boolean | Promise<boolean>;
    }

    Implemented by

    Index
    • Parameters

      • key: string

      Returns void | Promise<void>

    • Parameters

      • key: string

      Returns string | Promise<string | undefined> | undefined

    • Parameters

      • key: string
      • value: string
      • ttlSeconds: number

      Returns void | Promise<void>

    • Stores the value only if the key does not exist; returns whether it was stored

      Parameters

      • key: string
      • value: string
      • ttlSeconds: number

      Returns boolean | Promise<boolean>