Skip to content

BillingKeyStore — @gj-kit/toss-payments

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

import { BillingKeyStore } from '@gj-kit/toss-payments/server';
/** 저장소 필수 주입 — 토스에 빌링키 조회 API가 없다: 저장이 유일한 보관 수단. */
interface BillingKeyStore {
/**
* record를 upsert한다. `operationId`는 발급 뒤 별도 projection을 같은 customerKey
* fence 안에서 마무리해야 하는 소비자를 위한 비밀이 아닌 상관관계 식별자다.
*
* 구현은 값을 로그에 남기지 말고, 지원한다면 현재 row와 원자적으로 대조할 수 있는
* fingerprint/receipt만 보관해야 한다. 일반 save만 필요한 소비자는 생략할 수 있다.
*/
save(record: BillingKeyRecord, options?: BillingKeySaveOptions): Promise<void>;
find(customerKey: CustomerKey): Promise<BillingKeyRecord | null>;
/**
* 현재 저장된 billing key가 `expectedBillingKey`일 때만 원자적으로 삭제한다.
*
* `false`는 행이 없거나 더 새 키로 교체되어 아무 것도 지우지 않았다는 안전한 결과다.
* `find()` 후 일반 delete로 흉내 내면 재발급과 경합해 새 키를 지울 수 있으므로,
* 프로덕션 구현은 하나의 DB 조건문/CAS 또는 잠금 transaction으로 비교와 삭제를
* 함께 수행해야 한다. 저장소 실패만 throw한다.
*/
delete(request: BillingKeyDeleteRequest): Promise<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