@tosspayments/tosspayments-sdk 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types/index.d.ts CHANGED
@@ -1,2 +1,1767 @@
1
- export { clearTossPayments } from './clearTossPayments';
2
- export { loadTossPayments } from './loadTossPayments';
1
+ declare function clearTossPayments(): void;
2
+
3
+ interface WidgetSelectedPaymentMethod<CustomPaymentMethodCode = WidgetsPaymentMethodCode> {
4
+ /**
5
+ * 구매자가 결제 UI에서 선택한 결제수단입니다. 예를 들어, 신용・체크카드를 선택하면 `CARD` 코드가 응답됩니다. [ENUM 코드](/codes/enum-codes) 및 [기관 코드](/codes/org-codes)를 참고하세요.
6
+ */
7
+ code: WidgetsPaymentMethodCode | CustomPaymentMethodCode;
8
+ }
9
+ type WidgetsPaymentMethodCode = 'CARD' | 'VIRTUAL_ACCOUNT' | 'MOBILE_PHONE' | 'TRANSFER' | 'CULTURE_GIFT_CERTIFICATE' | 'GAME_GIFT_CERTIFICATE' | 'BOOK_GIFT_CERTIFICATE' | 'TOSSPAY' | 'NAVERPAY' | 'SAMSUNGPAY' | 'LPAY' | 'KAKAOPAY' | 'PAYCO' | 'SSG' | 'APPLEPAY' | 'PINPAY' | 'KBPAY' | 'PAYPAL' | 'GCASH' | 'TOUCHNGO' | 'BOOST' | 'BPI' | 'BILLEASE' | 'DANA' | 'ALIPAYHK' | 'TRUEMONEY' | 'RABBIT_LINE_PAY' | 'ALIPAY' | 'SHINHAN' | 'HYUNDAI' | 'SAMSUNG' | 'WOORI' | 'KOOKMIN' | 'LOTTE' | 'NONGHYEOP' | 'HANA' | 'BC' | 'KDBBANK' | 'TOSSBANK' | 'KAKAOBANK' | 'SUHYEOP' | 'JEONBUKBANK' | 'KBANK' | 'POST' | 'SAEMAUL' | 'CITI' | 'SAVINGBANK' | 'JEJUBANK' | 'GWANGJUBANK' | 'SHINHYEOP' | 'JCB' | 'UNIONPAY' | 'MASTER' | 'VISA' | 'DINERS' | 'DISCOVER' | 'IBK_BC' | 'AMEX' | 'TOSS_PAYMENTS' | 'BANKPAY' | 'BRANDPAY' | 'KEYIN';
10
+
11
+ interface WidgetPaymentMethodWidget {
12
+ /**
13
+ * 결제 UI의 이벤트를 구독합니다. [자세히 >](#paymentmethodwidgeton)
14
+ *
15
+ * @example
16
+ * ```javascript
17
+ * widgets.on('paymentMethodSelect', selectedPaymentMethod => {
18
+ if (paymentMethodSelected.code === '문화바우처') {
19
+ // 문화바우처 안내사항 노출
20
+ }
21
+
22
+ if (paymentMethodSelected.code === '카드') {
23
+ // 카드 안내사항 노출
24
+ }
25
+ });
26
+ * ```
27
+ *
28
+ * @param {'paymentMethodSelect'} eventName 구독할 이벤트입니다. `paymentMethodSelect` 이벤트로 구매자가 선택한 결제수단 정보를 확인하세요.
29
+ * @param {function} callback 이벤트가 일어나면 호출되는 콜백 함수입니다.
30
+ *
31
+ * @throws {@link PublicError.Widgets.InvalidEventParameterError} eventName이 유효하지 않은 경우
32
+ * @throws {@link PublicError.Widgets.InvalidCallbackParameterError} callback이 유효하지 않은 경우
33
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
34
+ */
35
+ on: {
36
+ (eventName: 'paymentMethodSelect', callback: <CustomPaymentMethodCode>(paymentMethod: WidgetSelectedPaymentMethod<CustomPaymentMethodCode>) => void): void;
37
+ };
38
+ /**
39
+ * 구매자가 선택한 결제수단을 불러옵니다. [자세히 >](#paymentmethodwidgetgetselectedpaymentmethod)
40
+ *
41
+ * @example
42
+ * ```javascript
43
+ * const paymentMethod = await paymentMethodWidget.getSelectedPaymentMethod();
44
+ * ```
45
+ *
46
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
47
+ */
48
+ getSelectedPaymentMethod: <CustomPaymentMethodCode>() => Promise<WidgetSelectedPaymentMethod<CustomPaymentMethodCode>>;
49
+ /**
50
+ * 결제 UI 객체를 제거합니다. [자세히 >](#paymentmethodwidgetdestroy)
51
+ *
52
+ * @example
53
+ * ```javascript
54
+ * await paymentMethodWidget.destroy();
55
+ * ```
56
+ *
57
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
58
+ */
59
+ destroy: () => Promise<void>;
60
+ }
61
+
62
+ interface WidgetAgreementStatus {
63
+ agreedRequiredTerms: boolean;
64
+ agreements: Array<{
65
+ term: {
66
+ id: string;
67
+ required: boolean;
68
+ };
69
+ agreed: boolean;
70
+ }>;
71
+ }
72
+
73
+ interface WidgetAgreementWidget {
74
+ /**
75
+ * 약관 UI의 이벤트를 구독합니다. [자세히](#widgetagreementwidgeton)
76
+ *
77
+ * @param {'agreementStatusChange'} eventName 구독할 이벤트입니다. `agreementStatusChange` 이벤트로 구매자가 약관에 동의했는지 확인하세요.
78
+ * @param {function} callback 이벤트가 일어나면 호출되는 콜백 함수입니다.
79
+ *
80
+ * @example
81
+ * ```javascript
82
+ * agreementWidget.on('agreementStatusChange', agreementStatus => {
83
+ if (agreementStatus.agreedRequiredTerms) {
84
+ // 결제 버튼 활성화
85
+ } else {
86
+ // 결제 버튼 비활성화
87
+ }
88
+ });
89
+ * ```
90
+ *
91
+ * @throws {@link PublicError.Widgets.InvalidEventParameterError} eventName이 유효하지 않은 경우
92
+ * @throws {@link PublicError.Widgets.InvalidCallbackParameterError} callback이 유효하지 않은 경우
93
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
94
+ */
95
+ on: (eventName: 'agreementStatusChange', callback: (agreementStatus: WidgetAgreementStatus) => void) => void;
96
+ /**
97
+ * 약관 UI 객체를 제거합니다. [자세히 >](#agreementwidgetdestroy)
98
+ *
99
+ * @example
100
+ * ```javascript
101
+ * await agreementWidget.destroy();
102
+ * ```
103
+ *
104
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
105
+ */
106
+ destroy: () => Promise<void>;
107
+ }
108
+
109
+ interface WidgetPaymentRequest {
110
+ /**
111
+ * 주문번호입니다. 각 주문을 구분하는 무작위한 고유값을 생성하세요. 영문 대소문자, 숫자, 특수문자 `-`, `_`, `=`로 이루어진 6자 이상 64자 이하의 문자열이어야 합니다.
112
+ */
113
+ orderId: string;
114
+ /**
115
+ * 구매상품입니다. 예를 들면 `생수 외 1건` 같은 형식입니다. 최대 길이는 100자입니다.
116
+ */
117
+ orderName: string;
118
+ /**
119
+ * 구매자 이메일입니다. 결제 상태가 바뀌면 이메일 주소로 결제내역이 전송됩니다. 최대 길이는 100자입니다.
120
+ */
121
+ customerEmail?: string;
122
+ /**
123
+ * 구매자명입니다. 최대 길이는 100자입니다.
124
+ */
125
+ customerName?: string;
126
+ /**
127
+ * 구매자의 휴대폰 번호입니다. 가상계좌 안내, 퀵계좌이체 휴대폰 번호 자동 완성에 사용되고 있어요.
128
+ */
129
+ customerMobilePhone?: string;
130
+ /**
131
+ * 결제 금액 중 면세 금액입니다. 면세 상점 혹은 복합 과세 상점으로 계약된 상점만 사용하세요. 자세한 내용은 세금 처리 가이드에서 확인하세요.
132
+ */
133
+ taxFreeAmount?: number;
134
+ /**
135
+ * 구매자가 카드를 선택하면 결제에 적용되는 옵션입니다.
136
+ */
137
+ card?: {
138
+ /**
139
+ * 과세를 제외한 결제 금액(컵 보증금 등)입니다. 값을 넣지 않으면 기본값인 0으로 설정됩니다.
140
+ * 과세 제외 금액이 있는 카드 결제는 부분 취소가 안 됩니다.
141
+ */
142
+ taxExemptionAmount?: number;
143
+ };
144
+ /**
145
+ * 구매자가 계좌이체를 선택하면 결제에 적용되는 옵션입니다.
146
+ */
147
+ transfer?: {
148
+ /**
149
+ * 에스크로 적용 여부입니다. `true`로 설정하면 구매자가 반드시 에스크로 적용에 동의해야 결제가 완료돼요.
150
+ * `false`로 설정하거나 파라미터를 설정하지 않으면 에스크로 적용을 구매자 선택에 맡겨요.
151
+ */
152
+ useEscrow?: boolean;
153
+ /**
154
+ * 각 상품의 상세 정보 객체를 담는 배열입니다. 에스크로를 사용하는 상점이라면 필수 파라미터입니다.
155
+ * 예를 들어 사용자가 세 가지 종류의 상품을 구매했다면 길이가 3인 배열이어야 합니다.
156
+ */
157
+ escrowProducts?: Array<{
158
+ /**
159
+ * 각 상품의 고유 ID입니다.
160
+ */
161
+ id?: string;
162
+ /**
163
+ * 상품명입니다.
164
+ */
165
+ name?: string;
166
+ /**
167
+ * 내 상점에서 사용하는 상품 관리 코드입니다.
168
+ */
169
+ code?: string;
170
+ /**
171
+ * 상품의 1개의 개별 가격입니다.
172
+ */
173
+ unitPrice?: number;
174
+ /**
175
+ * 상품 구매 수량입니다.
176
+ */
177
+ quantity?: number;
178
+ }>;
179
+ };
180
+ /**
181
+ * 구매자가 가상계좌를 선택하면 결제에 적용되는 옵션입니다.
182
+ */
183
+ virtualAccount?: {
184
+ /**
185
+ * 에스크로 사용 여부입니다. 값을 주지 않으면 결제창에서 고객이 직접 에스크로 결제 여부를 선택합니다.
186
+ */
187
+ useEscrow?: boolean;
188
+ /**
189
+ * 각 상품의 상세 정보 객체를 담는 배열입니다. 에스크로를 사용하는 상점이라면 필수 파라미터입니다.
190
+ * 예를 들어 사용자가 세 가지 종류의 상품을 구매했다면 길이가 3인 배열이어야 합니다.
191
+ */
192
+ escrowProducts?: Array<{
193
+ /**
194
+ * 각 상품의 고유 ID입니다.
195
+ */
196
+ id?: string;
197
+ /**
198
+ * 상품명입니다.
199
+ */
200
+ name?: string;
201
+ /**
202
+ * 내 상점에서 사용하는 상품 관리 코드입니다.
203
+ */
204
+ code?: string;
205
+ /**
206
+ * 상품의 1개의 개별 가격입니다.
207
+ */
208
+ unitPrice?: number;
209
+ /**
210
+ * 상품 구매 수량입니다.
211
+ */
212
+ quantity?: number;
213
+ }>;
214
+ };
215
+ /**
216
+ * 구매자가 해외간편결제를 선택하면 결제에 적용되는 옵션입니다.
217
+ */
218
+ foreignEasyPay?: {
219
+ country: string;
220
+ /**
221
+ * 구매 상품 정보입니다. 여러 가지의 상품을 결제했다면 각 상품의 정보를 입력하세요. 예를 들어, 구매자가 세 가지 종류의 상품을 구매했다면 배열의 길이는 3이어야 합니다.
222
+ *
223
+ * PayPal에서 제공하는 판매자 보호를 받고 싶다면 반드시 해당 파라미터를 사용하세요. 판매자 보호 및 위험거래 관리를 위해 PayPal에 제공돼요.
224
+ */
225
+ products?: Array<{
226
+ /**
227
+ * 상품명입니다.
228
+ */
229
+ name: string;
230
+ /**
231
+ * 상품의 구매 수량입니다.
232
+ */
233
+ quantity: number;
234
+ /**
235
+ * 상품의 1개의 개별 가격입니다.
236
+ */
237
+ unitAmount: number;
238
+ /**
239
+ * 결제 통화입니다.
240
+ */
241
+ currency: string;
242
+ /**
243
+ * 상품 설명입니다.
244
+ */
245
+ description: string;
246
+ }>;
247
+ /**
248
+ * 배송 정보입니다.
249
+ */
250
+ shipping?: {
251
+ /**
252
+ * 수령인입니다.
253
+ */
254
+ fullName?: string;
255
+ /**
256
+ * 배송 주소입니다.
257
+ */
258
+ address?: {
259
+ /**
260
+ * 국가입니다.
261
+ */
262
+ country: string;
263
+ /**
264
+ * 주소입니다. 도로명 및 건물(Street, Apt), 번지 정보입니다.
265
+ */
266
+ line1?: string;
267
+ /**
268
+ * 상세 주소입니다. 번지 및 동 호수 정보를 입력하세요.
269
+ */
270
+ line2?: string;
271
+ /**
272
+ * 주(State, Province, Region) 정보입니다. 국가의 도시 체계에 따라 없는 경우가 있습니다.
273
+ */
274
+ area1?: string;
275
+ /**
276
+ * 도시입니다.
277
+ */
278
+ area2: string;
279
+ /**
280
+ * 배송지 우편번호입니다. 중국, 일본, 프랑스, 독일 등 [일부 국가](https://developer.paypal.com/api/rest/reference/orders/v2/country-address-requirements/#link-countryandregionaddressrequirements)에서는 필수 파라미터입니다
281
+ */
282
+ postalCode?: string;
283
+ };
284
+ };
285
+ /**
286
+ * 특정 해외간편결제 수단에만 필요한 정보입니다.
287
+ */
288
+ paymentMethodOptions?: {
289
+ /**
290
+ * PayPal 결제에 추가로 필요한 정보입니다.
291
+ */
292
+ paypal?: {
293
+ /**
294
+ * PayPal에서 추가로 요청하는 STC(Set Transaction Context) 정보입니다. 이 정보는 토스페이먼츠에서 관리하지 않으며, PayPal에서 부정거래, 결제 취소, 환불 등 리스크 관리에 활용합니다.
295
+ * 결제 거래의 안전성과 신뢰성을 확보하려면 이 정보를 전달해야 합니다. [PayPal STC 문서](https://static.tosspayments.com/public/STC.pdf)를 참고해서 업종에 따라 필요한 파라미터를 추가해주세요.
296
+ * 문서의 표에 있는 ‘Data Field Name’ 컬럼 값을 객체의 ‘key’로, ‘Description’에 맞는 값을 객체의 ‘value’로 넣어주시면 됩니다.
297
+ */
298
+ setTransactionContext?: unknown;
299
+ };
300
+ };
301
+ };
302
+ }
303
+
304
+ interface Amount {
305
+ /**
306
+ * 결제 금액입니다.
307
+ */
308
+ value: number;
309
+ /**
310
+ * 결제 통화입니다.
311
+ */
312
+ currency: string;
313
+ }
314
+
315
+ type WithRedirection<T> = T & {
316
+ /**
317
+ * 결제 요청이 성공하면 리다이렉트되는 URL입니다. `https://www.example.com/success`와 같이 오리진을 포함한 형태로 설정해주세요.
318
+ * 리다이렉트되면 URL의 쿼리 파라미터로 `amount`, `orderId`, `paymentKey`가 추가돼요.
319
+ */
320
+ successUrl?: string;
321
+ /**
322
+ * 결제 요청이 실패하면 리다이렉트되는 URL입니다. `https://www.example.com/fail`와 같이 오리진을 포함한 형태로 설정해주세요.
323
+ * 리다이렉트되면 URL의 쿼리 파라미터로 에러 코드와 메시지를 확인할 수 있어요.
324
+ */
325
+ failUrl?: string;
326
+ };
327
+
328
+ type WidgetPaymentResult = {
329
+ /**
330
+ * 결제 타입입니다. `NORMAL`(일반결제), `BRANDPAY`(브랜드페이) 중 하나입니다.
331
+ */
332
+ paymentType: 'NORMAL' | 'BRANDPAY';
333
+ /**
334
+ * 토스페이먼츠에서 발급하는 결제 식별 키입니다. 결제 승인, 조회, 취소 등에 사용되니 반드시 저장하세요.
335
+ */
336
+ paymentKey: string;
337
+ /**
338
+ * 주문번호입니다. 결제를 요청할 때 호출한 `requestPayment()` 메서드로 넘긴 `orderId` 값과 같은지 확인하세요.
339
+ */
340
+ orderId: string;
341
+ /**
342
+ * 결제 금액 정보입니다. `requestPayment()` 메서드로 넘긴 `amount` 값과 같은지 확인하세요.
343
+ */
344
+ amount: Amount;
345
+ };
346
+
347
+ /**
348
+ * 결제 UI 위젯을 렌더링합니다
349
+ * @param {object} params 결제 UI 렌더링 정보입니다.
350
+ *
351
+ * @returns 반환되는 결제 UI 객체로 아래 메서드를 호출할 수 있어요.
352
+ *
353
+ * @example
354
+ * ```javascript
355
+ * const paymentMethodWidget = await widgets.renderPaymentMethods({
356
+ * selector: "#payment-method",
357
+ * variantKey: "CUSTOM-1"
358
+ });
359
+ * ```
360
+
361
+ * @throws {Widgets.UserCancelError} 사용자가 결제수단 위젯 렌더링을 취소한 경우
362
+ * @throws {@link PublicError.Widgets.NotSetupAmountError} 결제금액이 설정되지 않은 경우
363
+ * @throws {@link PublicError.Widgets.PaymentMethodsWidgetAlreadyRenderedError} 이미 결제수단 위젯이 렌더링 된 경우
364
+ * @throws {@link PublicError.Widgets.InvalidVariantKeyError} variantKey 가 유효하지 않은 경우
365
+ * @throws {@link PublicError.Widgets.InvalidSelectorError} selector 가 유효하지 않은 경우
366
+ * @throws {@link PublicError.Widgets.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
367
+ * @throws {@link PublicError.Widgets.InvalidParametersError} 파라미터가 올바르지 않은 경우
368
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
369
+ */
370
+ type RenderPaymentMethods = (params: {
371
+ /**
372
+ * 결제 UI를 렌더링할 위치를 지정합니다. `<div>`와 같은 HTML 요소를 선택할 수 있는 CSS 선택자를 사용합니다. 예를 들어 `<div id="payment-method">`에 결제 UI를 렌더링하려면, `#payment-method`를 전달해야 합니다.
373
+ */
374
+ selector: string;
375
+ /**
376
+ * 렌더링하고 싶은 결제 UI의 `variantKey`입니다. 2개 이상의 결제 UI를 사용하고 있다면 설정해주세요. `variantKey`는 [상점관리자의 결제위젯 어드민](/guides/v2/payment-widget#2-결제-ui의-variantkey-확인)에서 확인할 수 있어요. 기본 값은 `DEFAULT`입니다.
377
+ */
378
+ variantKey?: string;
379
+ }) => Promise<WidgetPaymentMethodWidget>;
380
+
381
+ /**
382
+ * 약관 위젯을 렌더링합니다
383
+ * @param {object} params 약관 UI 렌더링 정보입니다.
384
+ *
385
+ * @returns 반환되는 약관 UI 객체로 아래 메서드를 호출할 수 있어요.
386
+ *
387
+ * @example
388
+ * ```javascript
389
+ * const agreementWidget = await widgets.renderAgreement({
390
+ * selector: "#agreement",
391
+ * variantKey: "AGREEMENT"
392
+ * });
393
+ * ```
394
+ *
395
+ * @throws {@link PublicError.Widgets.UserCancelError} 사용자가 약관 위젯 렌더링을 취소한 경우
396
+ * @throws {@link PublicError.Widgets.AgreementWidgetAlreadyRenderedError} 이미 약관 위젯이 렌더링 된 경우
397
+ * @throws {@link PublicError.Widgets.InvalidSelectorError} selector 가 유효하지 않은 경우
398
+ * @throws {@link PublicError.Widgets.InvalidVariantKeyError} variantKey 가 유효하지 않은 경우
399
+ * @throws {@link PublicError.Widgets.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
400
+ * @throws {@link PublicError.Widgets.InvalidParametersError} 파라미터가 올바르지 않은 경우
401
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
402
+ */
403
+ type RenderAgreement = (params: {
404
+ /**
405
+ * 약관 UI를 렌더링할 위치를 지정합니다. `<div>`와 같은 HTML 요소를 선택할 수 있는 CSS 선택자를 사용합니다. 예를 들어 `<div id="agreement">`에 결제 UI를 렌더링하려면, `#agreement`를 전달해야 합니다.
406
+ */
407
+ selector: string;
408
+ /**
409
+ * 렌더링하고 싶은 약과 UI의 `variantKey`입니다. 상점관리자의 결제위젯 어드민에서 확인할 수 있어요.
410
+ */
411
+ variantKey?: string;
412
+ }) => Promise<WidgetAgreementWidget>;
413
+
414
+ /**
415
+ * 결제를 요청합니다
416
+ *
417
+ * @param {WidgetPaymentRequest} paymentRequest - 결제 요청 정보입니다.
418
+ *
419
+ * @returns 결제 결과
420
+ *
421
+ *
422
+ * @throws {@link PublicError.Widgets.UserCancelError} 사용자가 결제를 취소한 경우
423
+ * @throws {@link PublicError.Widgets.ProviderStatusUnhealthyError} 결제 기관의 시스템에 문제가 있을 때
424
+ * @throws {@link PublicError.Widgets.NotSelectedPaymentMethodError} 결제수단이 선택되어있지 않은 경우
425
+ * @throws {@link PublicError.Widgets.NeedAgreementWithRequiredTermsError} 모든 필수 약관에 동의하지 않은 경우
426
+ * @throws {@link PublicError.Widgets.NeedCardPaymentDetailError} 신용, 체크카드 결제 시, 카드사나 할부 기간을 선택하지 않은 경우
427
+ * @throws {@link PublicError.Widgets.NeedRefundAccountDetailError} 가상계좌 결제 시, 환불 계좌 정보를 입력하지 않은 경우
428
+ * @throws {@link PublicError.Widgets.ExceedDepositAmountLimitError} 가상계좌 결제 시, 입금 가능한 금액보다 큰 금액을 결제한 경우
429
+ * @throws {@link PublicError.Widgets.ExceedMaxDueDateError} 가상계좌 결제 시, 최대 유효만료 기간을 넘긴 경우
430
+ * @throws {@link PublicError.Widgets.UnsupportedTestPhasePaymentMethodError} 테스트 환경을 지원하지 않는 결제수단을 선택한 경우
431
+ * @throws {@link PublicError.Widgets.IncorrectSuccessUrlFormatError} successUrl이 유효하지 않은 경우
432
+ * @throws {@link PublicError.Widgets.IncorrectFailUrlFormatError} failUrl이 유효하지 않은 경우
433
+ * @throws {@link PublicError.Widgets.PaymentRequestFailError} 결제 요청에 실패한 경우
434
+ * @throws {@link PublicError.Widgets.NotSupportedPromiseError} promise 방식을 지원하지 않는 환경인 경우
435
+ * @throws {@link PublicError.Widgets.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
436
+ * @throws {@link PublicError.Widgets.InvalidParametersError} 파라미터가 올바르지 않은 경우
437
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
438
+ */
439
+ type RequestPayment$2 = RequestPaymentWithRedirection$1 & RequestPaymentWithPromise$1;
440
+ /**
441
+ * @docsAlias Promise 방식
442
+ * @returns `WidgetPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
443
+ * @param {WidgetPaymentRequest} paymentRequest 결제 요청 정보입니다.
444
+ *
445
+ * @example
446
+ * ```js
447
+ * widgets.requestPayment({
448
+ orderId: generateRandomString(),
449
+ orderName: "토스 티셔츠 외 2건",
450
+ customerEmail: "customer123@gmail.com",
451
+ customerName: "김토스",
452
+ customerMobilePhone: "01012341234",
453
+ });
454
+ * ```
455
+
456
+ */
457
+ type RequestPaymentWithPromise$1 = (paymentRequest: WidgetPaymentRequest) => Promise<WidgetPaymentResult>;
458
+ /**
459
+ * @docsAlias Redirect 방식
460
+ *
461
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해서 결제를 완료하세요.
462
+ * ```plain theme="grey" copyable="false"
463
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
464
+ * ```
465
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
466
+ * ```plain theme="grey" copyable="false"
467
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
468
+ * ```
469
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
470
+
471
+ * @param {WidgetPaymentRequest} paymentRequest 결제 요청 정보입니다.
472
+ *
473
+ * @example
474
+ * ```js
475
+ * widgets.requestPayment({
476
+ orderId: generateRandomString(),
477
+ orderName: "토스 티셔츠 외 2건",
478
+ successUrl: window.location.origin + "/success.html",
479
+ failUrl: window.location.origin + "/fail.html",
480
+ customerEmail: "customer123@gmail.com",
481
+ customerName: "김토스",
482
+ customerMobilePhone: "01012341234",
483
+ });
484
+ * ```
485
+ */
486
+ type RequestPaymentWithRedirection$1 = (paymentRequest: WithRedirection<WidgetPaymentRequest>) => Promise<void>;
487
+
488
+ /**
489
+ * 결제 금액을 변경합니다
490
+ *
491
+ * @param {Amount} amount 새로운 결제 금액입니다.
492
+ *
493
+ * @example
494
+ * ```javascript
495
+ * widgets.setAmount({
496
+ * currency: 'KRW',
497
+ * value: amount,
498
+ * });
499
+ * ```
500
+ *
501
+ * @throws {@link PublicError.Widgets.InvalidAmountValueError} 결제 금액이 유효하지 않은 경우
502
+ * @throws {@link PublicError.Widgets.InvalidAmountCurrencyError} 결제 금액의 통화가 유효하지 않은 경우
503
+ * @throws {@link PublicError.Widgets.BelowZeroAmountError} 결제 금액이 0원 이하인 경우
504
+ * @throws {@link PublicError.Widgets.InvalidParametersError} 파라미터가 올바르지 않은 경우
505
+ * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
506
+ */
507
+ type SetAmount = (amount: Amount) => Promise<void>;
508
+
509
+ interface TossPaymentsWidgets {
510
+ /**
511
+ * 주문의 결제 금액을 설정합니다. [자세히 >](#widgetssetamount)
512
+ */
513
+ setAmount: SetAmount;
514
+ /**
515
+ * 결제 UI를 렌더링합니다. [자세히 >](#widgetsrenderpaymentmethods)
516
+ */
517
+ renderPaymentMethods: RenderPaymentMethods;
518
+ /**
519
+ * 결제를 요청합니다. 구매자가 결제 UI에서 선택한 결제수단의 결제창을 띄워요. [자세히 >](#widgetsrequestpayment)
520
+ */
521
+ requestPayment: RequestPayment$2;
522
+ /**
523
+ * 약관 UI를 렌더링합니다. [자세히 >](#widgetsrenderagreement)
524
+ */
525
+ renderAgreement: RenderAgreement;
526
+ }
527
+
528
+ interface BrandpayAmount extends Amount {
529
+ currency: 'KRW';
530
+ }
531
+
532
+ interface BrandpayPaymentRequest {
533
+ /**
534
+ * 결제 금액 정보입니다.
535
+ */
536
+ amount: BrandpayAmount;
537
+ /**
538
+ * 주문번호입니다. 각 주문을 구분하는 무작위한 고유값을 생성하세요. 영문 대소문자, 숫자, 특수문자 `-`, `_`, `=`로 이루어진 6자 이상 64자 이하의 문자열이어야 합니다.
539
+ */
540
+ orderId: string;
541
+ /**
542
+ * 구매상품입니다. 예를 들면 `생수 외 1건` 같은 형식입니다. 최대 길이는 100자입니다.
543
+ */
544
+ orderName: string;
545
+ /**
546
+ * 구매자 이메일입니다. 결제 상태가 바뀌면 이메일 주소로 결제내역이 전송됩니다. 최대 길이는 100자입니다.
547
+ */
548
+ customerEmail?: string;
549
+ /**
550
+ * 구매자명입니다. 최대 길이는 100자입니다.
551
+ */
552
+ customerName?: string;
553
+ /**
554
+ * 결제 금액 중 면세 금액입니다. 면세 상점 혹은 복합 과세 상점으로 계약된 상점만 사용하세요. 자세한 내용은 세금 처리 가이드에서 확인하세요.
555
+ */
556
+ taxFreeAmount?: number;
557
+ }
558
+
559
+ interface BrandpayRequestPaymentResult {
560
+ /**
561
+ * 토스페이먼츠에서 발급하는 결제 식별 키입니다. 결제 승인, 조회, 취소 등에 사용되니 반드시 저장하세요.
562
+ */
563
+ paymentKey: string;
564
+ /**
565
+ * 주문번호입니다. 결제를 요청할 때 호출한 `requestPayment()` 메서드로 넘긴 `orderId` 값과 같은지 확인하세요.
566
+ */
567
+ orderId: string;
568
+ amount: BrandpayAmount;
569
+ }
570
+
571
+ /**
572
+ * 결제를 요청합니다
573
+ *
574
+ * @param {WithRedirection<BrandpayPaymentRequest> | BrandpayPaymentRequest} paymentRequest - 결제 요청 정보
575
+ *
576
+ *
577
+ * @throws {@link PublicError.Brandpay.UserCancelError} 사용자가 결제를 취소한 경우
578
+ * @throws {@link PublicError.Brandpay.InvalidAmountValueError} 결제 금액이 유효하지 않은 경우
579
+ * @throws {@link PublicError.Brandpay.BelowZeroAmountError} 결제 금액이 0 미만인 경우
580
+ * @throws {@link PublicError.Brandpay.IncorrectSuccessUrlFormatError} successUrl이 유효하지 않은 경우
581
+ * @throws {@link PublicError.Brandpay.IncorrectFailUrlFormatError} failUrl이 유효하지 않은 경우
582
+ * @throws {@link PublicError.Brandpay.PaymentRequestFailError} 결제 요청에 실패한 경우
583
+ * @throws {@link PublicError.Brandpay.NotRegisteredRedirectUrlError} redirectUrl이 등록되지 않은 경우
584
+ * @throws {@link PublicError.Brandpay.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
585
+ * @throws {@link PublicError.Brandpay.InvalidParametersError} 파라미터가 올바르지 않은 경우
586
+ * @throws {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
587
+ */
588
+ type RequestPayment$1 = RequestPaymentWithRedirection & RequestPaymentWithPromise;
589
+ /**
590
+ * @docsAlias Redirect 방식
591
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [브랜드페이 결제 승인 API](/reference/brandpay#결제-승인)를 호출해서 결제를 완료하세요.
592
+ * ```plain theme="grey" copyable="false"
593
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
594
+ * ```
595
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
596
+ * ```plain theme="grey" copyable="false"
597
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
598
+ * ```
599
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
600
+ *
601
+ * @param {WithRedirection<BrandpayPaymentRequest>} paymentRequest 결제 요청 정보입니다.
602
+ *
603
+ * @example
604
+ * ```javascript
605
+ * brandpay.requestPayment({
606
+ * amount: {
607
+ * currency: 'KRW',
608
+ * value: 50000,
609
+ * },
610
+ * orderId: "<UniqueId name='orderId.brandpay' />",
611
+ * orderName: '토스 티셔츠 외 2건',
612
+ * successUrl: window.location.origin + '/success.html',
613
+ * failUrl: window.location.origin + '/fail.html',
614
+ * customerEmail: 'customer123@gmail.com',
615
+ * customerName: '김토스',
616
+ * customerMobilePhone: '01012341234',
617
+ * });
618
+ * ```
619
+ */
620
+ type RequestPaymentWithRedirection = (paymentRequest: WithRedirection<BrandpayPaymentRequest>) => Promise<void>;
621
+ /**
622
+ * @docsAlias Promise 방식
623
+ * @returns `BrandpayRequestPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [브랜드페이 결제 승인 API](/reference/brandpay#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
624
+ * @param {BrandpayPaymentRequest} paymentRequest 결제 요청 정보입니다.
625
+ *
626
+ * @example
627
+ * ```javascript
628
+ * brandpay.requestPayment({
629
+ * amount: {
630
+ * currency: 'KRW',
631
+ * value: 50000,
632
+ * },
633
+ * orderId: "<UniqueId name='orderId.brandpay' />",
634
+ * orderName: '토스 티셔츠 외 2건',
635
+ * customerEmail: 'customer123@gmail.com',
636
+ * customerName: '김토스',
637
+ * customerMobilePhone: '01012341234',
638
+ * });
639
+ * ```
640
+ */
641
+ type RequestPaymentWithPromise = (paymentRequest: BrandpayPaymentRequest) => Promise<BrandpayRequestPaymentResult>;
642
+
643
+ /**
644
+ * 등록된 비밀번호를 변경합니다
645
+ *
646
+ *
647
+ * @example
648
+ * ```javascript
649
+ * brandpay.changePassword();
650
+ * ```
651
+ *
652
+ * @throws {@link PublicError.Brandpay.UserCancelError} 사용자가 비밀번호 변경을 취소한 경우
653
+ * @throws {@link PublicError.Brandpay.NotRegisteredRedirectUrlError} redirectUrl이 등록되지 않은 경우
654
+ * @throws {@link PublicError.Brandpay.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
655
+ * @throws {@link PublicError.Brandpay.InvalidParametersError} 파라미터가 올바르지 않은 경우
656
+ * @throws {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
657
+ *
658
+ * @returns
659
+ *
660
+ */
661
+ type ChangePassword = () => Promise<void>;
662
+
663
+ /**
664
+ * 새로운 결제수단을 등록합니다
665
+ *
666
+ *
667
+ * @example
668
+ * ```javascript
669
+ * brandpay.addPaymentMethod();
670
+ * ```
671
+ *
672
+ * @throws {@link PublicError.Brandpay.UserCancelError} 사용자가 결제수단 등록을 취소한 경우
673
+ * @throws {@link PublicError.Brandpay.NotRegisteredRedirectUrlError} redirectUrl이 등록되지 않은 경우
674
+ * @throws {@link PublicError.Brandpay.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
675
+ * @throws {@link PublicError.Brandpay.InvalidParametersError} 파라미터가 올바르지 않은 경우
676
+ * @throws {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
677
+ *
678
+ * @returns
679
+ */
680
+ type AddPaymentMethod = () => Promise<void>;
681
+
682
+ /**
683
+ * 설정 화면을 엽니다
684
+ *
685
+ *
686
+ * @example
687
+ * ```javascript
688
+ * brandpay.openSettings();
689
+ * ```
690
+ *
691
+ *
692
+ * @throws {@link PublicError.Brandpay.UserCancelError} 사용자가 설정 화면을 닫은 경우
693
+ * @throws {@link PublicError.Brandpay.NotRegisteredRedirectUrlError} redirectUrl이 등록되지 않은 경우
694
+ * @throws {@link PublicError.Brandpay.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
695
+ * @throws {@link PublicError.Brandpay.InvalidParametersError} 파라미터가 올바르지 않은 경우
696
+ * @throws {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
697
+ */
698
+ type OpenSettings = () => Promise<void>;
699
+
700
+ /**
701
+ * 원터치 결제 설정을 변경합니다
702
+ *
703
+ *
704
+ * @example
705
+ * ```javascript
706
+ * brandpay.changeOneTouchPay();
707
+ * ```
708
+ *
709
+ * @throws {@link PublicError.Brandpay.UserCancelError} 사용자가 원터치 결제 설정 화면을 닫은 경우
710
+ * @throws {@link PublicError.Brandpay.NeedMerchantOneTouchSettingError} 가맹점에서 원터치 결제 설정을 하지 않은 경우
711
+ * @throws {@link PublicError.Brandpay.NotRegisteredRedirectUrlError} redirectUrl이 등록되지 않은 경우
712
+ * @throws {@link PublicError.Brandpay.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
713
+ * @throws {@link PublicError.Brandpay.InvalidParametersError} 파라미터가 올바르지 않은 경우
714
+ * @throws {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
715
+ *
716
+ * @returns
717
+ */
718
+ type ChangeOneTouchPay = () => Promise<void>;
719
+
720
+ /**
721
+ * 원터치결제가 활성화되어있는지 확인합니다
722
+ *
723
+ *
724
+ * @example
725
+ * ```javascript
726
+ * const result = await brandpay.isOneTouchPayEnabled();
727
+ * alert(result);
728
+ * ```
729
+ *
730
+ * @throws {@link PublicError.Brandpay.NeedAgreementWithTermsError} 약관 동의가 필요한 경우
731
+ * @throws {@link PublicError.Brandpay.NeedMerchantOneTouchSettingError} 가맹점에서 원터치 결제 설정을 하지 않은 경우
732
+ * @throws {@link PublicError.Brandpay.NotRegisteredRedirectUrlError} redirectUrl이 등록되지 않은 경우
733
+ * @throws {@link PublicError.Brandpay.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
734
+ * @throws {@link PublicError.Brandpay.InvalidParametersError} 파라미터가 올바르지 않은 경우
735
+ * @throws {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
736
+ */
737
+ type IsOneTouchPayEnabled = () => Promise<{
738
+ /**
739
+ * 원터치결제 활성화 여부입니다. 원터치결제가 설정되어 있다면 `true`, 설정되어 있지 않으면 `false`입니다.
740
+ */
741
+ isEnabled: boolean;
742
+ }>;
743
+
744
+ interface TossPaymentsBrandpay {
745
+ /**
746
+ * 브랜드페이 결제창을 띄웁니다. [자세히 >](#brandpayrequestpayment)
747
+ */
748
+ requestPayment: RequestPayment$1;
749
+ /**
750
+ * 브랜드페이 결제 비밀번호를 변경하는 창을 띄웁니다. [자세히 >](#brandpaychangepassword)
751
+ */
752
+ changePassword: ChangePassword;
753
+ /**
754
+ * 브랜드페이에 새로운 결제수단을 추가합니다. [자세히 >](#brandpayaddpaymentmethod)
755
+ */
756
+ addPaymentMethod: AddPaymentMethod;
757
+ /**
758
+ * 브랜드페이 결제 관리 설정창을 띄웁니다. [자세히 >](#brandpayopensettings)
759
+ */
760
+ openSettings: OpenSettings;
761
+ /**
762
+ * 원터치결제 설정을 변경합니다. [자세히 >](#brandpaychangeonetouchpay)
763
+ */
764
+ changeOneTouchPay: ChangeOneTouchPay;
765
+ /**
766
+ * 원터치결제 활성화 여부를 확인합니다. [자세히 >](#brandpayisonetouchpayenabled)
767
+ */
768
+ isOneTouchPayEnabled: IsOneTouchPayEnabled;
769
+ }
770
+
771
+ interface PaymentRequest {
772
+ /**
773
+ * 결제 금액 정보입니다.
774
+ */
775
+ amount: Amount;
776
+ /**
777
+ * 구매상품입니다. 예를 들면 `생수 외 1건` 같은 형식입니다. 최대 길이는 100자입니다.
778
+ */
779
+ orderName: string;
780
+ /**
781
+ * 주문번호입니다. 각 주문을 구분하는 무작위한 고유값을 생성하세요. 영문 대소문자, 숫자, 특수문자 `-`, `_`, `=`로 이루어진 6자 이상 64자 이하의 문자열이어야 합니다.
782
+ */
783
+ orderId: string;
784
+ /**
785
+ * 구매자명입니다. 최대 길이는 100자입니다.
786
+ */
787
+ customerName?: string;
788
+ /**
789
+ * 구매자 이메일입니다. 결제 상태가 바뀌면 이메일 주소로 결제내역이 전송됩니다. 최대 길이는 100자입니다.
790
+ */
791
+ customerEmail?: string;
792
+ /**
793
+ * 구매자의 휴대폰 번호입니다. 가상계좌 안내, 퀵계좌이체 휴대폰 번호 자동 완성에 사용되고 있어요.
794
+ */
795
+ customerMobilePhone?: string;
796
+ /**
797
+ * 결제 금액 중 면세 금액입니다. 면세 상점 혹은 복합 과세 상점으로 계약된 상점만 사용하세요. 자세한 내용은 세금 처리 가이드에서 확인하세요.
798
+ */
799
+ taxFreeAmount?: number;
800
+ /**
801
+ * 결제창이 열리는 프레임입니다.
802
+ * `iframe` 또는 현재 브라우저 화면(`self`)에서 등록창을 열 수 있어요. 기본 값은 `iframe`입니다.
803
+ */
804
+ windowTarget?: 'iframe' | 'self';
805
+ }
806
+
807
+ interface CardPaymentRequest extends PaymentRequest {
808
+ /**
809
+ * 결제수단입니다. `CARD`로 설정하면 카드/간편결제 통합결제창, 카드・간편결제 자체창을 사용할 수 있어요.
810
+ */
811
+ method: 'CARD';
812
+ /**
813
+ * 카드 결제 정보입니다.
814
+ */
815
+ card?: {
816
+ /**
817
+ * 에스크로 적용 여부입니다. `true`로 설정하면 구매자가 반드시 에스크로 적용에 동의해야 결제가 완료돼요. `false`로 설정하거나 파라미터를 설정하지 않으면 에스크로 적용을 구매자 선택에 맡겨요.
818
+ */
819
+ useEscrow?: boolean;
820
+ /**
821
+ * 과세를 제외한 결제 금액(컵 보증금 등)입니다.
822
+ * 과세 제외 금액이 있는 카드 결제는 부분 취소가 안 됩니다.
823
+ */
824
+ taxExemptionAmount?: number;
825
+ /**
826
+ * 결제창을 여는 방법입니다. `DEFAULT`는 카드/간편결제 통합결제창을 열고, `DIRECT`는 카드 또는 간편결제의 자체창을 열어요.
827
+ * 기본 값은 `DEFAULT`입니다.
828
+ */
829
+ flowMode?: 'DIRECT' | 'DEFAULT';
830
+ /**
831
+ * 카드사 코드입니다. `flowMode` 값에 따라 아래와 같이 다르게 동작해요.
832
+ * `flowMode`가 `DIRECT`일 때는 입력한 코드의 카드사 앱이 열려요.
833
+ * `flowMode`가 `DEFAULT`일 때는 통합결제창에 입력한 코드의 카드사만 보여요.
834
+ */
835
+ cardCompany?: string;
836
+ /**
837
+ * 간편결제 코드입니다. `flowMode` 값에 따라 아래와 같이 다르게 동작해요.
838
+ * `flowMode`가 `DIRECT`일 때는 입력한 코드의 간편결제 앱이 열려요.
839
+ * `flowMode`가 `DEFAULT`일 때는 통합결제창에 입력한 코드의 간편결제만 보여요.
840
+ */
841
+ easyPay?: string;
842
+ /**
843
+ * 5만원 이상의 신용카드 결제에 적용되는 할부 개월 수입니다.
844
+ * 예를 들어, `6`으로 설정하면 할부 개월 수가 6개월로 고정돼요. 자체창에서는 구매자가 할부 개월 수를 볼 수 없으니 사전에 충분히 안내를 해주세요.
845
+ * 0(일시불), 2~12 값으로 설정할 수 있고 `maxCardInstallmentPlan` 파라미터와 함께 사용할 수 없어요.
846
+ */
847
+ cardInstallmentPlan?: number;
848
+ /**
849
+ * 5만원 이상의 신용카드 결제에 적용할 수 있는 최대 할부 개월 수입니다.
850
+ * 예를 들어, `6`으로 설정하면 구매자는 일시불부터 6개월 할부를 선택할 수 있어요. 0(일시불), 2~12 값으로 설정할 수 있고 `cardInstallmentPlan` 파라미터와 함께 사용할 수 없어요.
851
+ */
852
+ maxCardInstallmentPlan?: number;
853
+ /**
854
+ * 5만원 이상의 신용카드 결제에 적용할 수 있는 **상점 부담 무이자** 할부 정보입니다.
855
+ * 구매자가 선택한 카드, 할부 개월 수가 배열에 등록한 정보와 같다면 무이자가 할부가 자동으로 적용돼요.
856
+ */
857
+ freeInstallmentPlans?: Array<{
858
+ /**
859
+ * 상점 부담 무이자를 적용할 카드사 코드입니다.
860
+ */
861
+ company: string;
862
+ /**
863
+ * 상점 부담 무이자를 적용할 할부 개월입니다.
864
+ */
865
+ months: number[];
866
+ }>;
867
+ /**
868
+ * 카드사 포인트 사용 여부입니다. `true`로 설정하면 카드사 포인트 사용이 체크된 상태로 결제창이 열려요. `false`로 설정하거나 값을 넣지 않으면 구매자가 직접 카드사 포인트 사용 여부를 선택할 수 있어요.
869
+ *
870
+ * \* 추가 계약이 필요한 파라미터입니다. 토스페이먼츠 고객센터(1544-7772, support@tosspayments.com)로 문의해주세요.
871
+ */
872
+ useCardPoint?: boolean;
873
+ /**
874
+ * 앱카드 단독 사용 여부입니다. 'true'로 설정하면 카드사의 앱카드만 열려요. 국민, 농협, 롯데, 삼성, 신한, 우리, 현대 카드 결제에 적용할 수 있어요.
875
+ */
876
+ useAppCardOnly?: boolean;
877
+ /**
878
+ * 카드사의 프로모션 코드입니다. 프로모션은 `flowMode`가 `DIRECT`로 설정된 자체창 결제에만 사용할 수 있어요. 프로모션 조회 API로 적용할 수 있는 프로모션 코드를 확인하세요.
879
+ */
880
+ discountCode?: string;
881
+ /**
882
+ * 시간으로 설정하는 결제가 기한입니다. 설정할 수 있는 최대 값은 2160시간(90일)입니다.
883
+ * 기한이 지나고 시도하는 결제는 실패해요. 예를 들어 `24`로 설정하면, 결제 요청 시점으로부터 24시간 동안 결제할 수 있어요.
884
+ */
885
+ validHours?: number;
886
+ /**
887
+ * 특정일로 설정하는 결제 기한입니다. `yyyy-MM-dd'T'HH:mm:ss` ISO 8601 형식입니다.
888
+ * 기한이 지나고 시도하는 결제는 실패해요. 예를 들어 `2025-01-01T00:00:00`으로 설정하면, 2024년 12월 31일 23:59까지 결제할 수 있어요.
889
+ */
890
+ dueDate?: string;
891
+ escrowProducts?: Array<{
892
+ /**
893
+ * 각 상품의 고유 ID입니다.
894
+ */
895
+ id?: string;
896
+ /**
897
+ * 상품명입니다.
898
+ */
899
+ name?: string;
900
+ /**
901
+ * 내 상점에서 사용하는 상품 관리 코드입니다.
902
+ */
903
+ code?: string;
904
+ /**
905
+ * 상품의 1개의 개별 가격입니다.
906
+ */
907
+ unitPrice?: number;
908
+ /**
909
+ * 상품 구매 수량입니다.
910
+ */
911
+ quantity?: number;
912
+ }>;
913
+ };
914
+ }
915
+
916
+ interface VirtualAccountPaymentRequest extends PaymentRequest {
917
+ /**
918
+ * 결제수단입니다. 가상계좌 결제창을 열려면 `VIRTUAL_ACCOUNT`로 설정하세요.
919
+ */
920
+ method: 'VIRTUAL_ACCOUNT';
921
+ /**
922
+ * 가상계좌 결제 정보입니다.
923
+ */
924
+ virtualAccount?: {
925
+ /**
926
+ * 과세를 제외한 결제 금액(컵 보증금 등)입니다.
927
+ */
928
+ taxExemptionAmount?: number;
929
+ /**
930
+ * 현금영수증 발급 용도입니다.
931
+ */
932
+ cashReceipt?: {
933
+ type: '소득공제' | '지출증빙' | '미발행';
934
+ };
935
+ /**
936
+ * 에스크로 적용 여부입니다.
937
+ */
938
+ useEscrow?: boolean;
939
+ escrowProducts?: Array<{
940
+ /**
941
+ * 각 상품의 고유 ID입니다.
942
+ */
943
+ id?: string;
944
+ /**
945
+ * 상품명입니다.
946
+ */
947
+ name?: string;
948
+ /**
949
+ * 내 상점에서 사용하는 상품 관리 코드입니다.
950
+ */
951
+ code?: string;
952
+ /**
953
+ * 상품의 1개의 개별 가격입니다.
954
+ */
955
+ unitPrice?: number;
956
+ /**
957
+ * 상품 구매 수량입니다.
958
+ */
959
+ quantity?: number;
960
+ }>;
961
+ /**
962
+ * 시간으로 설정하는 결제가 기한입니다. 설정할 수 있는 최대 값은 2160시간(90일)입니다.
963
+ * 기한이 지나고 시도하는 결제는 실패해요. 예를 들어 `24`로 설정하면, 결제 요청 시점으로부터 24시간 동안 결제할 수 있어요.
964
+ */
965
+ validHours?: number;
966
+ /**
967
+ * 특정일로 설정하는 결제 기한입니다. `yyyy-MM-dd'T'HH:mm:ss` ISO 8601 형식입니다.
968
+ * 기한이 지나고 시도하는 결제는 실패해요. 예를 들어 `2025-01-01T00:00:00`으로 설정하면, 2024년 12월 31일 23:59까지 결제할 수 있어요.
969
+ */
970
+ dueDate?: string;
971
+ };
972
+ }
973
+
974
+ interface TransferPaymentRequest extends PaymentRequest {
975
+ /**
976
+ * 결제수단입니다. `TRANSFER`로 설정하면 퀵계좌이체 결제창이 열려요.
977
+ */
978
+ method: 'TRANSFER';
979
+ /**
980
+ * 계좌이체 정보입니다.
981
+ */
982
+ transfer?: {
983
+ /**
984
+ * 과세를 제외한 결제 금액(컵 보증금 등)입니다.
985
+ */
986
+ taxExemptionAmount?: number;
987
+ /**
988
+ * 현금영수증 정보입니다.
989
+ */
990
+ cashReceipt?: {
991
+ /**
992
+ * 현금영수증 발급 용도입니다.
993
+ */
994
+ type: '소득공제' | '지출증빙' | '미발행';
995
+ };
996
+ /**
997
+ * 에스크로 적용 여부입니다. `true`로 설정하면 구매자가 반드시 에스크로 적용에 동의해야 결제가 완료돼요.
998
+ * `false`로 설정하거나 파라미터를 설정하지 않으면 에스크로 적용을 구매자 선택에 맡겨요.
999
+ */
1000
+ useEscrow?: boolean;
1001
+ /**
1002
+ * 에스크로 상품 정보입니다.
1003
+ * 여러 가지의 상품을 결제했다면 각 상품의 정보를 입력하세요. 예를 들어, 구매자가 세 가지 종류의 상품을 구매했다면 배열의 길이는 3이어야 합니다.
1004
+ */
1005
+ escrowProducts?: Array<{
1006
+ /**
1007
+ * 각 상품의 고유 ID입니다.
1008
+ */
1009
+ id?: string;
1010
+ /**
1011
+ * 상품명입니다.
1012
+ */
1013
+ name?: string;
1014
+ /**
1015
+ * 내 상점에서 사용하는 상품 관리 코드입니다.
1016
+ */
1017
+ code?: string;
1018
+ /**
1019
+ * 상품의 1개의 개별 가격입니다.
1020
+ */
1021
+ unitPrice?: number;
1022
+ /**
1023
+ * 상품 구매 수량입니다.
1024
+ */
1025
+ quantity?: number;
1026
+ }>;
1027
+ /**
1028
+ * 시간으로 설정하는 결제가 기한입니다. 설정할 수 있는 최대 값은 2160시간(90일)입니다.
1029
+ * 기한이 지나고 시도하는 결제는 실패해요. 예를 들어 `24`로 설정하면, 결제 요청 시점으로부터 24시간 동안 결제할 수 있어요.
1030
+ */
1031
+ validHours?: number;
1032
+ /**
1033
+ * 특정일로 설정하는 결제 기한입니다. `yyyy-MM-dd'T'HH:mm:ss` ISO 8601 형식입니다.
1034
+ * 기한이 지나고 시도하는 결제는 실패해요. 예를 들어 `2025-01-01T00:00:00`으로 설정하면, 2024년 12월 31일 23:59까지 결제할 수 있어요.
1035
+ */
1036
+ dueDate?: string;
1037
+ };
1038
+ }
1039
+
1040
+ interface MobilePhonePaymentRequest extends PaymentRequest {
1041
+ /**
1042
+ * 결제수단입니다. `MOBILE_PHONE`으로 설정하면 휴대폰 결제창이 열려요.
1043
+ */
1044
+ method: 'MOBILE_PHONE';
1045
+ }
1046
+
1047
+ interface GiftCertificatePaymentRequest extends PaymentRequest {
1048
+ /**
1049
+ * 결제수단입니다. 토스페이먼츠는 세 종류의 상품권을 지원해요: 문화상품권(`CULTURE_GIFT_CERTIFICATE`), 도서문화상품권(`BOOK_GIFT_CERTIFICATE`), 게임문화상품권(`GAME_GIFT_CERTIFICATE`).
1050
+ */
1051
+ method: 'CULTURE_GIFT_CERTIFICATE' | 'BOOK_GIFT_CERTIFICATE' | 'GAME_GIFT_CERTIFICATE';
1052
+ }
1053
+
1054
+ interface ForeignEasyPayPaymentRequest extends PaymentRequest {
1055
+ /**
1056
+ * 결제수단입니다. `FOREIGN_EASY_PAY`로 설정하면 PayPal 해외 간편결제를 사용할 수 있어요.
1057
+ */
1058
+ method: 'FOREIGN_EASY_PAY';
1059
+ /**
1060
+ * 해외 간편결제 정보입니다.
1061
+ */
1062
+ foreignEasyPay: {
1063
+ /**
1064
+ * 해외간편결제 코드입니다. 현재는 `PAYPAL`만 지원하고 있어요.
1065
+ */
1066
+ provider: string;
1067
+ /**
1068
+ * 구매자가 결제한 국가입니다. ISO-3166의 두 자리 국가 코드를 입력하세요.
1069
+ */
1070
+ country: string;
1071
+ /**
1072
+ * 구매 상품 정보입니다. 여러 가지의 상품을 결제했다면 각 상품의 정보를 입력하세요. 예를 들어, 구매자가 세 가지 종류의 상품을 구매했다면 배열의 길이는 3이어야 합니다.
1073
+ *
1074
+ * PayPal에서 제공하는 판매자 보호를 받고 싶다면 반드시 해당 파라미터를 사용하세요. 판매자 보호 및 위험거래 관리를 위해 PayPal에 제공돼요.
1075
+ */
1076
+ products?: Array<{
1077
+ /**
1078
+ * 상품명입니다.
1079
+ */
1080
+ name: string;
1081
+ /**
1082
+ * 상품의 구매 수량입니다.
1083
+ */
1084
+ quantity: number;
1085
+ /**
1086
+ * 상품의 1개의 개별 가격입니다.
1087
+ */
1088
+ unitAmount: number;
1089
+ /**
1090
+ * 결제 통화입니다.
1091
+ */
1092
+ currency: string;
1093
+ /**
1094
+ * 상품 설명입니다.
1095
+ */
1096
+ description: string;
1097
+ }>;
1098
+ /**
1099
+ * 배송 정보입니다.
1100
+ */
1101
+ shipping?: {
1102
+ /**
1103
+ * 수령인입니다.
1104
+ */
1105
+ fullName?: string;
1106
+ /**
1107
+ * 배송 주소입니다.
1108
+ */
1109
+ address?: {
1110
+ /**
1111
+ * 국가입니다.
1112
+ */
1113
+ country: string;
1114
+ /**
1115
+ * 주소입니다. 도로명 및 건물(Street, Apt), 번지 정보입니다.
1116
+ */
1117
+ line1?: string;
1118
+ /**
1119
+ * 상세 주소입니다. 번지 및 동 호수 정보를 입력하세요.
1120
+ */
1121
+ line2?: string;
1122
+ /**
1123
+ * 주(State, Province, Region) 정보입니다. 국가의 도시 체계에 따라 없는 경우가 있습니다.
1124
+ */
1125
+ area1?: string;
1126
+ /**
1127
+ * 도시입니다.
1128
+ */
1129
+ area2: string;
1130
+ /**
1131
+ * 배송지 우편번호입니다. 중국, 일본, 프랑스, 독일 등 [일부 국가](https://developer.paypal.com/api/rest/reference/orders/v2/country-address-requirements/#link-countryandregionaddressrequirements)에서는 필수 파라미터입니다
1132
+ */
1133
+ postalCode?: string;
1134
+ };
1135
+ };
1136
+ /**
1137
+ * 특정 해외간편결제 수단에만 필요한 정보입니다.
1138
+ */
1139
+ paymentMethodOptions?: {
1140
+ /**
1141
+ * PayPal 결제에 추가로 필요한 정보입니다.
1142
+ */
1143
+ paypal?: {
1144
+ /**
1145
+ * PayPal에서 추가로 요청하는 STC(Set Transaction Context) 정보입니다. 이 정보는 토스페이먼츠에서 관리하지 않으며, PayPal에서 부정거래, 결제 취소, 환불 등 리스크 관리에 활용합니다.
1146
+ * 결제 거래의 안전성과 신뢰성을 확보하려면 이 정보를 전달해야 합니다. [PayPal STC 문서](https://static.tosspayments.com/public/STC.pdf)를 참고해서 업종에 따라 필요한 파라미터를 추가해주세요.
1147
+ * 문서의 표에 있는 ‘Data Field Name’ 컬럼 값을 객체의 ‘key’로, ‘Description’에 맞는 값을 객체의 ‘value’로 넣어주시면 됩니다.
1148
+ */
1149
+ setTransactionContext?: unknown;
1150
+ };
1151
+ };
1152
+ };
1153
+ }
1154
+
1155
+ interface RequestPaymentResult {
1156
+ /**
1157
+ * 토스페이먼츠에서 발급하는 결제 식별 키입니다. 결제 승인, 조회, 취소 등에 사용되니 반드시 저장하세요.
1158
+ */
1159
+ paymentKey: string;
1160
+ /**
1161
+ * 주문번호입니다. 결제를 요청할 때 호출한 `requestPayment()` 메서드로 넘긴 `orderId` 값과 같은지 확인하세요.
1162
+ */
1163
+ orderId: string;
1164
+ /**
1165
+ * 결제 금액 정보입니다. `requestPayment()` 메서드로 넘긴 `amount` 값과 같은지 확인하세요.
1166
+ */
1167
+ amount: Amount;
1168
+ }
1169
+
1170
+ interface BillingAuthRequest {
1171
+ /**
1172
+ * 자동결제(빌링)에 등록할 결제수단입니다. 토스페이먼츠는 현재 신용·체크카드만 자동결제만 지원해요.
1173
+ *
1174
+ */
1175
+ method: 'CARD';
1176
+ /**
1177
+ * 카드 등록이 성공하면 리다이렉트되는 URL입니다. 리다이렉트되면 URL의 쿼리 파라미터로 `authKey`, `customerKey`가 추가돼요. 값을 검증하고 [빌링키 발급 API](/reference#authkey로-카드-빌링키-발급)를 호출하세요.
1178
+ * 반드시 오리진을 포함해야 합니다.
1179
+ *
1180
+ * @example https://www.example.com/success
1181
+ */
1182
+ successUrl: string;
1183
+ /**
1184
+ * 카드 등록이 실패하면 리다이렉트되는 URL입니다. 리다이렉트되면 URL의 쿼리 파라미터로 에러 코드와 메시지를 확인할 수 있어요.
1185
+ * 반드시 오리진을 포함해야 합니다.
1186
+ */
1187
+ failUrl: string;
1188
+ /**
1189
+ * 구매자명입니다. 상점관리자 및 결제내역 이메일에 사용됩니다. 최대 길이는 100자입니다.
1190
+ */
1191
+ customerName?: string;
1192
+ /**
1193
+ * 구매자의 이메일 주소입니다. 결제 상태가 바뀌면 이메일 주소로 결제내역이 전송됩니다. 최대 길이는 100자입니다.
1194
+ */
1195
+ customerEmail?: string;
1196
+ /**
1197
+ * 카드 등록창이 열리는 프레임입니다. iframe 또는 현재 브라우저 화면(self)에서 등록창을 열 수 있습니다. 기본 값은 `iframe`입니다.
1198
+ * 모바일 웹에서는 windowTarget 값과 상관없이 항상 새로운 결제창으로 이동합니다.
1199
+ *
1200
+ * @default 'iframe'
1201
+ */
1202
+ windowTarget?: 'iframe' | 'self';
1203
+ }
1204
+
1205
+ /**
1206
+ *
1207
+ * @throws {@link PublicError.PaymentGateway.UserCancelError} 사용자가 결제창을 닫은 경우
1208
+ * @throws {@link PublicError.PaymentGateway.InvalidAmountValueError} 결제 금액이 유효하지 않은 경우
1209
+ * @throws {@link PublicError.PaymentGateway.InvalidAmountCurrencyError} 결제 금액의 통화가 유효하지 않은 경우
1210
+ * @throws {@link PublicError.PaymentGateway.BelowZeroAmountError} 결제 금액이 0 미만인 경우
1211
+ * @throws {@link PublicError.PaymentGateway.NotSupportedPromiseError} promise 방식을 지원하지 않는 환경인 경우
1212
+ * @throws {@link PublicError.PaymentGateway.NotSupportedMethodError} 가맹점에서 정의되지 않은 method를 넘겨준 경우
1213
+ * @throws {@link PublicError.PaymentGateway.IncorrectSuccessUrlFormatError} 가맹점에서 유효하지 않은 successUrl을 넘겨준 경우
1214
+ * @throws {@link PublicError.PaymentGateway.IncorrectFailUrlFormatError} 가맹점에서 유효하지 않은 failUrl을 넘겨준 경우
1215
+ * @throws {@link PublicError.PaymentGateway.PaymentRequestFailError} 결제에 실패한 경우
1216
+ * @throws {@link PublicError.PaymentGateway.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
1217
+ * @throws {@link PublicError.PaymentGateway.InvalidParametersError} 파라미터가 올바르지 않은 경우
1218
+ * @throws {@link PublicError.PaymentGateway.UnknownError} 알 수 없는 오류가 발생한 경우
1219
+ */
1220
+ type RequestPayment = RequestCardPaymentWithRedirection & RequestCardPaymentWithPromise & RequestVirtualAccountPaymentWithRedirection & RequestVirtualAccountPaymentWithPromise & RequestTransferPaymentWithRedirection & RequestTransferPaymentWithPromise & RequestMobilePhonePaymentWithRedirection & RequestMobilePhonePaymentWithPromise & RequestGiftCertificatePaymentWithRedirection & RequestGiftCertificatePaymentWithPromise & RequestForeignEasyPayPaymentWithRedirection & RequestForeignEasyPayPaymentWithPromise;
1221
+ /**
1222
+ * @docsAlias 카드(Promise 방식)
1223
+ * @returns `WidgetPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
1224
+ * @param {RequestCardPaymentWithPromise} paymentRequest 결제 요청 정보입니다.
1225
+ *
1226
+ * @example
1227
+ * ```javascript
1228
+ * payment.requestPayment({
1229
+ method: "CARD",
1230
+ amount: {
1231
+ currency: "KRW",
1232
+ value: 50000,
1233
+ },
1234
+ orderId: "<UniqueId name='orderId.card' />",
1235
+ orderName: "토스 티셔츠 외 2건",
1236
+ customerEmail: "customer123@gmail.com",
1237
+ customerName: "김토스",
1238
+ customerMobilePhone: "01012341234",
1239
+ windowTarget: "iframe",
1240
+ card: {
1241
+ useEscrow: false,
1242
+ flowMode: "DEFAULT",
1243
+ useCardPoint: false,
1244
+ useAppCardOnly: false,
1245
+ },
1246
+ });
1247
+ * ```
1248
+ */
1249
+ type RequestCardPaymentWithPromise = (paymentRequest: CardPaymentRequest) => Promise<RequestPaymentResult>;
1250
+ /**
1251
+ * @docsAlias 카드(Redirect 방식)
1252
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해서 결제를 완료하세요.
1253
+ * ```plain theme="grey" copyable="false"
1254
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
1255
+ * ```
1256
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
1257
+ * ```plain theme="grey" copyable="false"
1258
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
1259
+ * ```
1260
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
1261
+ *
1262
+ * @param {RequestCardPaymentWithRedirection} paymentRequest 결제 요청 정보입니다.
1263
+ *
1264
+ * @example
1265
+ * ```javascript
1266
+ * payment.requestPayment({
1267
+ method: "CARD",
1268
+ amount: {
1269
+ currency: "KRW",
1270
+ value: 50000,
1271
+ },
1272
+ orderId: "<UniqueId name='orderId.card' />",
1273
+ orderName: "토스 티셔츠 외 2건",
1274
+ successUrl: window.location.origin + "/success.html",
1275
+ failUrl: window.location.origin + "/fail.html",
1276
+ customerEmail: "customer123@gmail.com",
1277
+ customerName: "김토스",
1278
+ customerMobilePhone: "01012341234",
1279
+ card: {
1280
+ useEscrow: false,
1281
+ flowMode: "DEFAULT",
1282
+ useCardPoint: false,
1283
+ useAppCardOnly: false,
1284
+ },
1285
+ })
1286
+ * ```
1287
+ */
1288
+ type RequestCardPaymentWithRedirection = (paymentRequest: WithRedirection<CardPaymentRequest>) => Promise<void>;
1289
+ /**
1290
+ * @docsAlias 가상계좌(Promise 방식)
1291
+ * @returns `WidgetPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
1292
+ * @param {VirtualAccountPaymentRequest} paymentRequest 결제 요청 정보입니다.
1293
+ *
1294
+ * @example
1295
+ * ```javascript
1296
+ * payment.requestPayment({
1297
+ method: "VIRTUAL_ACCOUNT",
1298
+ amount: {
1299
+ currency: "KRW",
1300
+ value: 50000,
1301
+ },
1302
+ orderId: "<UniqueId name='orderId.virtualaccount' />",
1303
+ orderName: "토스 티셔츠 외 2건",
1304
+ customerEmail: "customer123@gmail.com",
1305
+ customerName: "김토스",
1306
+ customerMobilePhone: "01012341234",
1307
+ windowTarget: "iframe",
1308
+ virtualAccount: {
1309
+ cashReceipt: {
1310
+ type: "소득공제",
1311
+ },
1312
+ useEscrow: false,
1313
+ validHours: 24,
1314
+ },
1315
+ });
1316
+ * ```
1317
+ */
1318
+ type RequestVirtualAccountPaymentWithPromise = (paymentRequest: VirtualAccountPaymentRequest) => Promise<RequestPaymentResult>;
1319
+ /**
1320
+ * @docsAlias 가상계좌(Redirect 방식)
1321
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해서 결제를 완료하세요.
1322
+ * ```plain theme="grey" copyable="false"
1323
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
1324
+ * ```
1325
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
1326
+ * ```plain theme="grey" copyable="false"
1327
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
1328
+ * ```
1329
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
1330
+ *
1331
+ * @param {RequestVirtualAccountPaymentWithRedirection} paymentRequest 결제 요청 정보입니다.
1332
+ *
1333
+ * @example
1334
+ * ```javascript
1335
+ * payment.requestPayment({
1336
+ method: "VIRTUAL_ACCOUNT",
1337
+ amount: {
1338
+ currency: "KRW",
1339
+ value: 50000,
1340
+ },
1341
+ orderId: "<UniqueId name='orderId.virtualaccount' />",
1342
+ orderName: "토스 티셔츠 외 2건",
1343
+ successUrl: window.location.origin + "/success.html",
1344
+ failUrl: window.location.origin + "/fail.html",
1345
+ customerEmail: "customer123@gmail.com",
1346
+ customerName: "김토스",
1347
+ customerMobilePhone: "01012341234",
1348
+ virtualAccount: {
1349
+ cashReceipt: {
1350
+ type: "소득공제",
1351
+ },
1352
+ useEscrow: false,
1353
+ validHours: 24,
1354
+ },
1355
+ });
1356
+ * ```
1357
+ */
1358
+ type RequestVirtualAccountPaymentWithRedirection = (paymentRequest: WithRedirection<VirtualAccountPaymentRequest>) => Promise<void>;
1359
+ /**
1360
+ * @docsAlias 계좌이체(Promise 방식)
1361
+ * @returns `WidgetPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
1362
+ * @param {RequestTransferPaymentWithPromise} paymentRequest 결제 요청 정보입니다.
1363
+ *
1364
+ * @example
1365
+ * ```javascript
1366
+ * payment.requestPayment({
1367
+ method: "TRANSFER",
1368
+ amount: {
1369
+ currency: "KRW",
1370
+ value: 50000,
1371
+ },
1372
+ orderId: "<UniqueId name='orderId.transfer' />",
1373
+ orderName: "토스 티셔츠 외 2건",
1374
+ customerEmail: "customer123@gmail.com",
1375
+ customerName: "김토스",
1376
+ customerMobilePhone: "01012341234",
1377
+ transfer: {
1378
+ cashReceipt: {
1379
+ type: "소득공제",
1380
+ },
1381
+ useEscrow: false,
1382
+ },
1383
+ });
1384
+ * ```
1385
+ */
1386
+ type RequestTransferPaymentWithPromise = (paymentRequest: TransferPaymentRequest) => Promise<RequestPaymentResult>;
1387
+ /**
1388
+ * @docsAlias 계좌이체(Redirect 방식)
1389
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해서 결제를 완료하세요.
1390
+ * ```plain theme="grey" copyable="false"
1391
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
1392
+ * ```
1393
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
1394
+ * ```plain theme="grey" copyable="false"
1395
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
1396
+ * ```
1397
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
1398
+ *
1399
+ * @param {RequestTransferPaymentWithRedirection} paymentRequest 결제 요청 정보입니다.
1400
+ *
1401
+ * @example
1402
+ * ```javascript
1403
+ * payment.requestPayment({
1404
+ method: "TRANSFER",
1405
+ amount: {
1406
+ currency: "KRW",
1407
+ value: 50000,
1408
+ },
1409
+ orderId: "<UniqueId name='orderId.transfer' />",
1410
+ orderName: "토스 티셔츠 외 2건",
1411
+ successUrl: window.location.origin + "/success.html",
1412
+ failUrl: window.location.origin + "/fail.html",
1413
+ customerEmail: "customer123@gmail.com",
1414
+ customerName: "김토스",
1415
+ customerMobilePhone: "01012341234",
1416
+ transfer: {
1417
+ cashReceipt: {
1418
+ type: "소득공제",
1419
+ },
1420
+ useEscrow: false,
1421
+ },
1422
+ });
1423
+ * ```
1424
+ */
1425
+ type RequestTransferPaymentWithRedirection = (paymentRequest: WithRedirection<TransferPaymentRequest>) => Promise<void>;
1426
+ /**
1427
+ * @docsAlias 휴대폰 결제(Promise 방식)
1428
+ * @returns `WidgetPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
1429
+ * @param {RequestMobilePhonePaymentWithPromise} paymentRequest 결제 요청 정보입니다.
1430
+ *
1431
+ * @example
1432
+ * ```javascript
1433
+ * payment.requestPayment({
1434
+ method: "MOBILE_PHONE",
1435
+ amount: {
1436
+ currency: "KRW",
1437
+ value: 50000,
1438
+ },
1439
+ orderId: "<UniqueId name='orderId.mobile' />",
1440
+ orderName: "토스 티셔츠 외 2건",
1441
+ customerEmail: "customer123@gmail.com",
1442
+ customerName: "김토스",
1443
+ customerMobilePhone: "01012341234",
1444
+ });
1445
+ * ```
1446
+ */
1447
+ type RequestMobilePhonePaymentWithPromise = (paymentRequest: MobilePhonePaymentRequest) => Promise<RequestPaymentResult>;
1448
+ /**
1449
+ * @docsAlias 휴대폰 결제(Redirect 방식)
1450
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해서 결제를 완료하세요.
1451
+ * ```plain theme="grey" copyable="false"
1452
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
1453
+ * ```
1454
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
1455
+ * ```plain theme="grey" copyable="false"
1456
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
1457
+ * ```
1458
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
1459
+ *
1460
+ * @param {RequestMobilePhonePaymentWithRedirection} paymentRequest 결제 요청 정보입니다.
1461
+ *
1462
+ * @example
1463
+ * ```javascript
1464
+ * payment.requestPayment({
1465
+ method: "MOBILE_PHONE",
1466
+ amount: {
1467
+ currency: "KRW",
1468
+ value: 50000,
1469
+ },
1470
+ orderId: "<UniqueId name='orderId.mobile' />",
1471
+ orderName: "토스 티셔츠 외 2건",
1472
+ successUrl: window.location.origin + "/success.html",
1473
+ failUrl: window.location.origin + "/fail.html",
1474
+ customerEmail: "customer123@gmail.com",
1475
+ customerName: "김토스",
1476
+ customerMobilePhone: "01012341234",
1477
+ });
1478
+ * ```
1479
+ */
1480
+ type RequestMobilePhonePaymentWithRedirection = (paymentRequest: WithRedirection<MobilePhonePaymentRequest>) => Promise<void>;
1481
+ /**
1482
+ * @docsAlias 상품권(Promise 방식)
1483
+ * @returns `WidgetPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
1484
+ * @param {RequestGiftCertificatePaymentWithPromise} paymentRequest 결제 요청 정보입니다.
1485
+ *
1486
+ * @example
1487
+ * ```javascript
1488
+ * payment.requestPayment({
1489
+ method: "CULTURE_GIFT_CERTIFICATE",
1490
+ amount: {
1491
+ currency: "KRW",
1492
+ value: 50000,
1493
+ },
1494
+ orderId: "<UniqueId name='orderId.giftcertificate' />",
1495
+ orderName: "토스 티셔츠 외 2건",
1496
+ customerEmail: "customer123@gmail.com",
1497
+ customerName: "김토스",
1498
+ customerMobilePhone: "01012341234",
1499
+ });
1500
+ * ```
1501
+ */
1502
+ type RequestGiftCertificatePaymentWithPromise = (paymentRequest: GiftCertificatePaymentRequest) => Promise<RequestPaymentResult>;
1503
+ /**
1504
+ * @docsAlias 상품권(Redirect 방식)
1505
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해서 결제를 완료하세요.
1506
+ * ```plain theme="grey" copyable="false"
1507
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
1508
+ * ```
1509
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
1510
+ * ```plain theme="grey" copyable="false"
1511
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
1512
+ * ```
1513
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
1514
+ *
1515
+ * @param {RequestGiftCertificatePaymentWithRedirection} paymentRequest 결제 요청 정보입니다.
1516
+ *
1517
+ * @example
1518
+ * ```javascript
1519
+ * payment.requestPayment({
1520
+ method: "CULTURE_GIFT_CERTIFICATE",
1521
+ amount: {
1522
+ currency: "KRW",
1523
+ value: 50000,
1524
+ },
1525
+ orderId: "<UniqueId name='orderId.giftcertificate' />",
1526
+ orderName: "토스 티셔츠 외 2건",
1527
+ successUrl: window.location.origin + "/success.html",
1528
+ failUrl: window.location.origin + "/fail.html",
1529
+ customerEmail: "customer123@gmail.com",
1530
+ customerName: "김토스",
1531
+ customerMobilePhone: "01012341234",
1532
+ });
1533
+ * ```
1534
+ */
1535
+ type RequestGiftCertificatePaymentWithRedirection = (paymentRequest: WithRedirection<GiftCertificatePaymentRequest>) => Promise<void>;
1536
+ /**
1537
+ * @docsAlias 해외 간편결제(Promise 방식)
1538
+ * @returns `WidgetPaymentResult` 객체가 응답됩니다. 객체 필드를 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해야 결제가 최종적으로 완료돼요.
1539
+ * @param {RequestForeignEasyPayPaymentWithPromise} paymentRequest 결제 요청 정보입니다.
1540
+ *
1541
+ * @example
1542
+ * ```javascript
1543
+ * payment.requestPayment({
1544
+ method: "FOREIGN_EASY_PAY",
1545
+ amount: {
1546
+ currency: "USD",
1547
+ value: 5000,
1548
+ },
1549
+ orderId: "<UniqueId name='orderId.paypal' />",
1550
+ orderName: "토스 티셔츠 외 2건",
1551
+ customerEmail: "customer123@gmail.com",
1552
+ customerName: "김토스",
1553
+ customerMobilePhone: "01012341234",
1554
+ foreignEasyPay: {
1555
+ provider: "PAYPAL",
1556
+ country: "KR",
1557
+ },
1558
+ });
1559
+ * ```
1560
+ */
1561
+ type RequestForeignEasyPayPaymentWithPromise = (paymentRequest: ForeignEasyPayPaymentRequest) => Promise<RequestPaymentResult>;
1562
+ /**
1563
+ * @docsAlias 해외 간편결제(Redirect 방식)
1564
+ * @returns 결제 요청이 성공하면 파라미터로 설정한 `successUrl`로 이동해요. 쿼리 파라미터의 `amount` 값이 파라미터로 설정한 `amount`와 같은지 반드시 확인하고 [결제 승인 API](/reference#결제-승인)를 호출해서 결제를 완료하세요.
1565
+ * ```plain theme="grey" copyable="false"
1566
+ * {successUrl}?amount={AMOUNT}&orderId={ORDER_ID}&paymentKey={PAYMENT_KEY}
1567
+ * ```
1568
+ * 결제 요청이 실패하면 파라미터로 설정한 `failUrl`로 이동해요. 쿼리 파라미터로 에러 코드와 메시지를 확인하세요.
1569
+ * ```plain theme="grey" copyable="false"
1570
+ * {failUrl}?code={ERROR_CODE}&message={ERROR_MESSAGE}&orderId={ORDER_ID}
1571
+ * ```
1572
+ * Redirect 방식에서는 URL이 이동하기 때문에 `void`가 응답됩니다.
1573
+ *
1574
+ * @param {RequestForeignEasyPayPaymentWithRedirection} paymentRequest 결제 요청 정보입니다.
1575
+ *
1576
+ * @example
1577
+ * ```javascript
1578
+ * payment.requestPayment({
1579
+ method: "FOREIGN_EASY_PAY",
1580
+ amount: {
1581
+ currency: "USD",
1582
+ value: 5000,
1583
+ },
1584
+ orderId: "<UniqueId name='orderId.paypal' />",
1585
+ orderName: "토스 티셔츠 외 2건",
1586
+ successUrl: window.location.origin + "/success.html",
1587
+ failUrl: window.location.origin + "/fail.html",
1588
+ customerEmail: "customer123@gmail.com",
1589
+ customerName: "김토스",
1590
+ customerMobilePhone: "01012341234",
1591
+ foreignEasyPay: {
1592
+ provider: "PAYPAL",
1593
+ country: "KR",
1594
+ },
1595
+ });
1596
+ * ```
1597
+ */
1598
+ type RequestForeignEasyPayPaymentWithRedirection = (paymentRequest: WithRedirection<ForeignEasyPayPaymentRequest>) => Promise<void>;
1599
+
1600
+ /**
1601
+ * 자동결제(빌링) 결제창을 열어 구매자의 카드 등록을 요청하는 메서드입니다.
1602
+ *
1603
+ * @param {BillingAuthRequest} billingAuthRequest 자동결제(빌링) 카드 등록에 필요한 정보입니다.
1604
+ * @returns URL이 이동하기 때문에 `void`가 응답됩니다. 파라미터로 설정한 `successUrl` 또는 `failUrl`에서 카드 등록 결과를 확인하고 [빌링키 발급 API](/reference#authkey로-카드-빌링키-발급)를 호출해야 자동결제를 할 수 있어요.
1605
+ *
1606
+ * @example
1607
+ * ```javascript
1608
+ * payment.requestBillingAuth({
1609
+ * method: 'CARD',
1610
+ * amount: {
1611
+ * currency: 'KRW',
1612
+ * value: 50000,
1613
+ * },
1614
+ * successUrl: window.location.origin + '/payment/billing.html',
1615
+ * failUrl: window.location.origin + '/fail.html',
1616
+ * customerEmail: 'customer123@gmail.com',
1617
+ * customerName: '김토스',
1618
+ * });
1619
+ * ```
1620
+ *
1621
+ * @throws {@link PublicError.PaymentGateway.UserCancelError} 사용자가 자동결제 인증창을 닫은 경우
1622
+ * @throws {@link PublicError.PaymentGateway.NotSupportedMethodError} 가맹점에서 정의되지 않은 method를 넘겨준 경우
1623
+ * @throws {@link PublicError.PaymentGateway.IncorrectSuccessUrlFormatError} 가맹점에서 유효하지 않은 successUrl을 넘겨준 경우
1624
+ * @throws {@link PublicError.PaymentGateway.IncorrectFailUrlFormatError} 가맹점에서 유효하지 않은 failUrl을 넘겨준 경우
1625
+ * @throws {@link PublicError.PaymentGateway.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
1626
+ * @throws {@link PublicError.PaymentGateway.InvalidParametersError} 파라미터가 올바르지 않은 경우
1627
+ * @throws {@link PublicError.PaymentGateway.UnknownError} 알 수 없는 오류가 발생한 경우
1628
+ */
1629
+ type RequestBillingAuth = (billingAuthRequest: BillingAuthRequest) => Promise<void>;
1630
+
1631
+ interface TossPaymentsPaymentGateway {
1632
+ /**
1633
+ * 결제창을 띄웁니다. [자세히 >](#paymentrequestpayment)
1634
+ */
1635
+ requestPayment: RequestPayment;
1636
+ /**
1637
+ * 자동결제(빌링) 카드 등록창을 띄웁니다. [자세히 >](#paymentrequestbillingauth)
1638
+ */
1639
+ requestBillingAuth: RequestBillingAuth;
1640
+ }
1641
+ interface TossPaymentsInstance {
1642
+ /**
1643
+ *
1644
+ * 결제위젯을 초기화합니다. [자세히 >](#결제위젯)
1645
+ *
1646
+ * @throw {@link PublicError.Widgets.InvalidClientKeyError} clientKey가 올바르지 않은 경우
1647
+ * @throw {@link PublicError.Widgets.InvalidCustomerKeyError} customerKey가 올바르지 않은 경우
1648
+ * @throw {@link PublicError.Widgets.WidgetsSDKInitializeConflictError} widgets SDK 초기화 중 충돌이 발생한 경우
1649
+ * @throw {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
1650
+ * @returns 아래 메서드를 호출할 수 있는 결제위젯 객체를 반환합니다.
1651
+ * @example
1652
+ * ```javascript
1653
+ * // 회원 결제
1654
+ * const widgets = tossPayments.widgets({ customerKey });
1655
+ * // 비회원 결제
1656
+ * // const payment = tossPayments.widgets({ customerKey: TossPayments.ANONYMOUS });
1657
+ * ```
1658
+ * @param {WidgetSDKInitParams} params 결제위젯 초기화 정보입니다.
1659
+ *
1660
+ */
1661
+ widgets: (params: WidgetSDKInitParams) => TossPaymentsWidgets;
1662
+ /**
1663
+ * 브랜드페이를 초기화합니다. [자세히 >](#브랜드페이)
1664
+ *
1665
+ * @throw {@link PublicError.Brandpay.InvalidClientKeyError} clientKey가 올바르지 않은 경우
1666
+ * @throw {@link PublicError.Brandpay.InvalidCustomerKeyError} customerKey가 올바르지 않은 경우
1667
+ * @throw {@link PublicError.Brandpay.BrandpaySDKInitializeConflictError} 브랜드페이 SDK 초기화 중 충돌이 발생한 경우
1668
+ * @throw {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
1669
+ * @example
1670
+ * ```javascript
1671
+ * const brandpay = tossPayments.brandpay({
1672
+ * customerKey,
1673
+ * redirectUrl: window.location.origin + '/callback-auth',
1674
+ * });
1675
+ * ```
1676
+ * @returns 아래 메서드를 호출할 수 있는 브랜드페이 객체를 반환합니다.
1677
+ * @param {BrandpaySDKInitParams} params 브랜드페이 초기화 정보입니다.
1678
+ *
1679
+ */
1680
+ brandpay: (params: BrandpaySDKInitParams) => TossPaymentsBrandpay;
1681
+ /**
1682
+ * 결제창을 초기화합니다. [자세히 >](#결제창)
1683
+ *
1684
+ * @throw {@link PublicError.Payment.InvalidClientKeyError} clientKey가 올바르지 않은 경우
1685
+ * @throw {@link PublicError.Payment.InvalidCustomerKeyError} customerKey가 올바르지 않은 경우
1686
+ * @throw {@link PublicError.Payment.PaymentSDKInitializeConflictError} payment SDK 초기화 중 충돌이 발생한 경우
1687
+ * @throw {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
1688
+ * @example
1689
+ * ```javascript
1690
+ * // 회원 결제
1691
+ * const payment = tossPayments.payment({ customerKey });
1692
+ *
1693
+ * //비회원 결제
1694
+ * // const payment = tossPayments.payment({ customerKey: TossPayments.ANONYMOUS });
1695
+ * ```
1696
+ * @returns 아래 메서드를 호출할 수 있는 결제창 객체를 반환합니다.
1697
+ * @param {PaymentGatewaySDKInitParams} 결제창 초기화 정보입니다.
1698
+ *
1699
+ */
1700
+ payment: (params: PaymentGatewaySDKInitParams) => TossPaymentsPaymentGateway;
1701
+ }
1702
+ /**
1703
+ * @example
1704
+ * ```javascript
1705
+ * const tossPayments = TossPayments("<WidgetClientKey />");
1706
+ * ```
1707
+ * @param {string} clientKey 토스페이먼츠 발급하는 클라이언트 키입니다. 개발자센터의 [API 키 메뉴](https://developers.tosspayments.com/my/api-keys)에서 확인할 수 있어요.
1708
+ *
1709
+ * 결제위젯을 연동한다면 [결제위젯 연동 키](/reference/using-api/api-keys#결제위젯-연동-키)를 사용하세요. 결제창, 자동결제(빌링)을 연동한다면 [API 개별 연동 키](/reference/using-api/api-keys#api-개별-연동-키)를 사용하세요.
1710
+ *
1711
+ * @returns
1712
+ * 아래 메서드를 호출할 수 있는 토스페이먼츠 객체를 반환합니다.
1713
+ */
1714
+ type TossPayments = (clientKey: string) => TossPaymentsInstance;
1715
+ interface BrandpaySDKInitParams {
1716
+ /**
1717
+ * 구매자를 식별하는 고유 아이디입니다.
1718
+ * 이메일・전화번호나 자동 증가하는 숫자와 같이 유추가 가능한 값은 안전하지 않아요. UUID와 같이 충분히 무작위적인 고유 값으로 생성해주세요.
1719
+ * 영문 대소문자, 숫자, 특수문자 `-`, `_`, `=`, `.`, `@` 중 최소 1개를 포함하는 최소 2자 이상 최대 50자 이하의 문자열이어야 합니다.
1720
+ */
1721
+ customerKey: string;
1722
+ /**
1723
+ * 브랜드페이 결제 과정에서 [Access Token 발급](/guides/v2/brandpay/auth)을 위해 필요한 URL입니다. Access Token은 브랜드페이 고객을 식별하고 고객의 결제 권한을 증명합니다. 값을 넣지 않으면 개발자센터의 브랜드페이 메뉴에 최초로 등록한 리다이렉트 URL이 기본값으로 들어갑니다.
1724
+ *
1725
+ * \* 브랜드페이 메뉴에 두 개 이상의 리다이렉트 URL을 등록한 상점은 각 도메인에 맞는 redirectUrl 값을 필수로 추가하세요.
1726
+ */
1727
+ redirectUrl?: string;
1728
+ }
1729
+ /**
1730
+ * @returns 아래 메서드를 호출할 수 있는 토스페이먼츠 객체를 반환합니다.
1731
+ */
1732
+ interface WidgetSDKInitParams {
1733
+ /**
1734
+ * 구매자를 식별하는 고유 아이디입니다.
1735
+ * 이메일・전화번호나 자동 증가하는 숫자와 같이 유추가 가능한 값은 안전하지 않아요. UUID와 같이 충분히 무작위적인 고유 값으로 생성해주세요.
1736
+ * 영문 대소문자, 숫자, 특수문자 `-`, `_`, `=`, `.`, `@` 중 최소 1개를 포함하는 최소 2자 이상 최대 50자 이하의 문자열이어야 합니다.
1737
+ */
1738
+ customerKey: string;
1739
+ /**
1740
+ * 결제위젯으로 브랜드페이로 연동할 때 필요한 정보입니다.
1741
+ */
1742
+ brandpay?: {
1743
+ /**
1744
+ * 브랜드페이 결제 과정에서 [Access Token 발급](/guides/v2/brandpay/auth)을 위해 필요한 URL입니다. Access Token은 브랜드페이 고객을 식별하고 고객의 결제 권한을 증명합니다. 값을 넣지 않으면 개발자센터의 브랜드페이 메뉴에 최초로 등록한 리다이렉트 URL이 기본값으로 들어갑니다.
1745
+ *
1746
+ * \* 브랜드페이 메뉴에 두 개 이상의 리다이렉트 URL을 등록한 상점은 각 도메인에 맞는 redirectUrl 값을 필수로 추가하세요.
1747
+ */
1748
+ redirectUrl?: string;
1749
+ };
1750
+ }
1751
+ interface PaymentGatewaySDKInitParams {
1752
+ /**
1753
+ * 구매자를 식별하는 고유 아이디입니다.
1754
+ * 이메일・전화번호나 자동 증가하는 숫자와 같이 유추가 가능한 값은 안전하지 않아요. UUID와 같이 충분히 무작위적인 고유 값으로 생성해주세요.
1755
+ * 영문 대소문자, 숫자, 특수문자 `-`, `_`, `=`, `.`, `@` 중 최소 1개를 포함하는 최소 2자 이상 최대 50자 이하의 문자열이어야 합니다.
1756
+ */
1757
+ customerKey: string;
1758
+ }
1759
+
1760
+ type TosspaymentsParams = Parameters<TossPayments>;
1761
+ declare function loadTossPayments(clientKey: TosspaymentsParams[0], loadOptions?: {
1762
+ src?: string;
1763
+ }): Promise<TossPaymentsInstance>;
1764
+
1765
+ declare const ANONYMOUS = "@@ANONYMOUS";
1766
+
1767
+ export { ANONYMOUS, clearTossPayments, loadTossPayments };