Skip to content

createTossPayments — @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 { createTossPayments } from '@gj-kit/toss-payments/server';
/**
* 파사드 팩토리 — 오버로드 2종(API 키 / 위젯 키). 위젯 키 + `billingKeys`는 어느
* 오버로드도 충족하지 못해 컴파일 에러다(키 쌍 규칙 선차단).
*
* ⚠ config를 스프레드로 동적 구성하면 `const` 추론이 풀려 조건부 프로퍼티 판정이
* 무너질 수 있다 — 동적 구성이 필요하면 기존 개별 팩토리 4종을 직접 사용하라.
* forRootAsync 등 간접 전달에는 {@link defineTossPaymentsConfig}로 추론을 고정하라.
*/
declare function createTossPayments<E extends Env, const C extends TossPaymentsApiConfig<E>>(config: C & {
readonly secretKey: ApiSecretKey<E>;
}): TossPaymentsKit<E, 'api', C>;
declare function createTossPayments<E extends Env, const C extends TossPaymentsWidgetConfig<E>>(config: C & {
readonly secretKey: WidgetSecretKey<E>;
}): TossPaymentsKit<E, 'widget', C>;

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