Skip to content

PaymentStateInput — @gj-kit/toss-payments

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

import { PaymentStateInput } from '@gj-kit/toss-payments/server';
/**
* The minimal structural input {@link summarizePaymentState} actually reads — exactly these
* eight fields, nothing else (verified against the implementation: the lifecycle, amount and
* consistency judgments consume `status`/`totalAmount`/`balanceAmount`/`lastTransactionKey`/
* `isPartialCancelable`/`cancels`, and the snapshot carries `paymentKey`/`orderId`).
*
* A full `Payment` is always assignable — including a fresh inline object literal:
* {@link summarizePaymentState} is typed `PaymentStateInput | Payment`, and the `Payment`
* union member exists solely so TypeScript's excess-property check accepts literals that
* spell out non-Pick `Payment` fields (`version`, `requestedAt`, …). Existing call sites
* compile unchanged. The point of the reduced shape is the opposite direction: an app-owned
* payment view that stripped `raw`/`secret`/card details can still produce a snapshot,
* **provided its eight fields are faithful copies of a real Payment response**. Do not fabricate `lastTransactionKey`,
* `isPartialCancelable` or `cancels` to satisfy the type — the consistency and
* cancelability judgments would then describe your fabrication, not the provider state.
*/
type PaymentStateInput = Pick<Payment, "paymentKey" | "orderId" | "status" | "totalAmount" | "balanceAmount" | "lastTransactionKey" | "isPartialCancelable" | "cancels">;

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