Skip to content

isWithinIdempotencyReplayWindow — @gj-kit/toss-payments

A public function from @gj-kit/toss-payments/server. The signature below is taken directly from the 0.6.1 release declaration.

import { isWithinIdempotencyReplayWindow } from '@gj-kit/toss-payments/server';
/**
* Whether a key first used at `issuedAt` may still be **replayed** (same key, same body) at `now`.
*
* Exact semantics: returns `true` when `now - issuedAt < windowMs` — elapsed time strictly less
* than the window. At exactly `windowMs` the window has closed and the result is `false`.
* A negative elapsed time (`issuedAt` after `now`, e.g. clock skew) counts as within the window;
* reject implausible future timestamps separately if your flow needs to. Any non-finite operand
* (invalid `Date`, `NaN`, `±Infinity` — in `issuedAt`, `now`, or `windowMs`) yields `false`, the
* side that never resubmits.
*
* `windowMs` defaults to {@link DEFAULT_IDEMPOTENCY_REPLAY_WINDOW_MS}; pass
* {@link TOSS_IDEMPOTENCY_KEY_TTL_MS} only if you deliberately want the provider's full window
* with no safety margin.
*/
declare function isWithinIdempotencyReplayWindow(issuedAt: Date | number, now: Date | number, windowMs?: number): boolean;

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/toss-payments
  • Version: 0.6.1
  • Public entry: ./server
  • Source: GitHub