@tosspayments/tosspayments-sdk 2.6.0 → 2.7.1
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/dist/index.cjs.js +76 -22
- package/dist/index.esm.js +76 -22
- package/package.json +11 -3
- package/types/index.d.ts +96 -2
package/dist/index.cjs.js
CHANGED
|
@@ -2,18 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var SCRIPT_URL = 'https://js.tosspayments.com/v2/standard';
|
|
6
|
-
|
|
7
|
-
function clearTossPayments() {
|
|
8
|
-
var _script$parentElement;
|
|
9
|
-
|
|
10
|
-
var script = document.querySelector("script[src=\"".concat(SCRIPT_URL, "\"]"));
|
|
11
|
-
script === null || script === void 0 ? void 0 : (_script$parentElement = script.parentElement) === null || _script$parentElement === void 0 ? void 0 : _script$parentElement.removeChild(script); // TODO: public interface에서 TossPayments의 global declaration 추가한 뒤 제거 예정입니다
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
|
|
14
|
-
window.TossPayments = undefined;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
5
|
function _classCallCheck(instance, Constructor) {
|
|
18
6
|
if (!(instance instanceof Constructor)) {
|
|
19
7
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -156,13 +144,23 @@ function _createSuper(Derived) {
|
|
|
156
144
|
};
|
|
157
145
|
}
|
|
158
146
|
|
|
159
|
-
|
|
147
|
+
// `${src}::${namespace}` 조합으로 캐싱하여 서로 다른 src/namespace 가 같은 캐시를 공유하지 않도록 합니다.
|
|
148
|
+
// (이전 구현은 module-level 단일 promise라 첫 호출만 기억되어, 두 번째 호출이 다른 src 를 전달해도
|
|
149
|
+
// 기존 promise 가 반환되던 문제가 있었습니다.)
|
|
150
|
+
var cache = new Map();
|
|
151
|
+
|
|
152
|
+
function cacheKey(src, namespace) {
|
|
153
|
+
return "".concat(src, "::").concat(namespace);
|
|
154
|
+
}
|
|
155
|
+
|
|
160
156
|
function loadScript(src, namespace) {
|
|
161
157
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
158
|
+
var key = cacheKey(src, namespace); // Return the cached Promise if it exists for this src/namespace combination
|
|
159
|
+
|
|
160
|
+
var hit = cache.get(key);
|
|
162
161
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return cachedPromise;
|
|
162
|
+
if (hit != null) {
|
|
163
|
+
return hit;
|
|
166
164
|
}
|
|
167
165
|
|
|
168
166
|
var promise = new Promise(function (resolve, reject) {
|
|
@@ -215,13 +213,32 @@ function loadScript(src, namespace) {
|
|
|
215
213
|
reject(error);
|
|
216
214
|
return;
|
|
217
215
|
}
|
|
218
|
-
}); // Reset the cache if the Promise is rejected
|
|
216
|
+
}); // Reset the cache entry if the Promise is rejected so the next call can retry
|
|
219
217
|
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
var cached = promise["catch"](function (error) {
|
|
219
|
+
cache["delete"](key);
|
|
222
220
|
return Promise.reject(error);
|
|
223
221
|
});
|
|
224
|
-
|
|
222
|
+
cache.set(key, cached);
|
|
223
|
+
return cached;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* 캐싱된 loadScript Promise 를 비웁니다.
|
|
227
|
+
*
|
|
228
|
+
* - 인자 없이 호출하면 전체 캐시를 비웁니다.
|
|
229
|
+
* - src 와 namespace 를 모두 전달하면 해당 조합의 캐시만 제거합니다.
|
|
230
|
+
*
|
|
231
|
+
* 외부 SDK 의 reset/cleanup 로직에서 namespace 와 script 를 함께 정리할 때 호출하여
|
|
232
|
+
* 다음 loadScript 호출이 stale promise 를 반환하지 않도록 합니다.
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
function clearCache(src, namespace) {
|
|
236
|
+
if (src != null && namespace != null) {
|
|
237
|
+
cache["delete"](cacheKey(src, namespace));
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
cache.clear();
|
|
225
242
|
}
|
|
226
243
|
|
|
227
244
|
function getNamespace(name) {
|
|
@@ -264,6 +281,13 @@ var ScriptLoadFailedError = /*#__PURE__*/function (_Error2) {
|
|
|
264
281
|
return ScriptLoadFailedError;
|
|
265
282
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
266
283
|
|
|
284
|
+
var SCRIPT_URL = 'https://js.tosspayments.com/v2/standard';
|
|
285
|
+
|
|
286
|
+
var NAMESPACE = 'TossPayments'; // loadTossPayments 가 시도한 (src, namespace) 를 모듈 내부에 추적하여, clearTossPayments 가
|
|
287
|
+
// 호출 시점에 정확히 동일한 스크립트와 sdk-loader 의 cache entry 를 정리할 수 있도록 합니다.
|
|
288
|
+
// key 는 src 만 사용 (namespace 는 현재 고정), 같은 src 의 중복 load 는 자연스럽게 dedupe 됩니다.
|
|
289
|
+
|
|
290
|
+
var loadedRequests = new Map();
|
|
267
291
|
function loadTossPayments(clientKey) {
|
|
268
292
|
var loadOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
269
293
|
var _loadOptions$src = loadOptions.src,
|
|
@@ -272,14 +296,44 @@ function loadTossPayments(clientKey) {
|
|
|
272
296
|
if (typeof window === 'undefined') {
|
|
273
297
|
// XXX(@HyunSeob): SSR할 때 생성자가 사용되는 경우 에러를 발생시키지 않는대신 정상적인 인스턴스를 반환하지 않는다.
|
|
274
298
|
return Promise.resolve({});
|
|
275
|
-
}
|
|
299
|
+
}
|
|
276
300
|
|
|
301
|
+
loadedRequests.set(src, {
|
|
302
|
+
src: src,
|
|
303
|
+
namespace: NAMESPACE
|
|
304
|
+
}); // regenerator-runtime 의존성을 없애기 위해 `async` 키워드를 사용하지 않는다
|
|
277
305
|
|
|
278
|
-
return loadScript(src,
|
|
306
|
+
return loadScript(src, NAMESPACE).then(function (TossPayments) {
|
|
279
307
|
return TossPayments(clientKey);
|
|
280
308
|
});
|
|
281
309
|
}
|
|
282
310
|
|
|
311
|
+
function clearTossPayments() {
|
|
312
|
+
var _defaultScript$parent;
|
|
313
|
+
|
|
314
|
+
if (typeof document === 'undefined' || typeof window === 'undefined') {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
loadedRequests.forEach(function (_ref) {
|
|
319
|
+
var _script$parentElement;
|
|
320
|
+
|
|
321
|
+
var src = _ref.src,
|
|
322
|
+
namespace = _ref.namespace;
|
|
323
|
+
var script = document.querySelector("script[src=\"".concat(src, "\"]"));
|
|
324
|
+
script === null || script === void 0 ? void 0 : (_script$parentElement = script.parentElement) === null || _script$parentElement === void 0 ? void 0 : _script$parentElement.removeChild(script);
|
|
325
|
+
clearCache(src, namespace);
|
|
326
|
+
});
|
|
327
|
+
loadedRequests.clear(); // fallback: loadTossPayments 를 거치지 않고 HTML inline / SSR / 다른 코드 경로로 직접 inject 된
|
|
328
|
+
// default SCRIPT_URL 스크립트도 함께 정리합니다. (기존 동작 호환)
|
|
329
|
+
|
|
330
|
+
var defaultScript = document.querySelector("script[src=\"".concat(SCRIPT_URL, "\"]"));
|
|
331
|
+
defaultScript === null || defaultScript === void 0 ? void 0 : (_defaultScript$parent = defaultScript.parentElement) === null || _defaultScript$parent === void 0 ? void 0 : _defaultScript$parent.removeChild(defaultScript); // TODO: public interface에서 TossPayments의 global declaration 추가한 뒤 제거 예정입니다
|
|
332
|
+
// @ts-ignore
|
|
333
|
+
|
|
334
|
+
delete window.TossPayments;
|
|
335
|
+
}
|
|
336
|
+
|
|
283
337
|
var ANONYMOUS = '@@ANONYMOUS';
|
|
284
338
|
|
|
285
339
|
exports.ANONYMOUS = ANONYMOUS;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
var SCRIPT_URL = 'https://js.tosspayments.com/v2/standard';
|
|
2
|
-
|
|
3
|
-
function clearTossPayments() {
|
|
4
|
-
var _script$parentElement;
|
|
5
|
-
|
|
6
|
-
var script = document.querySelector("script[src=\"".concat(SCRIPT_URL, "\"]"));
|
|
7
|
-
script === null || script === void 0 ? void 0 : (_script$parentElement = script.parentElement) === null || _script$parentElement === void 0 ? void 0 : _script$parentElement.removeChild(script); // TODO: public interface에서 TossPayments의 global declaration 추가한 뒤 제거 예정입니다
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
|
|
10
|
-
window.TossPayments = undefined;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
1
|
function _classCallCheck(instance, Constructor) {
|
|
14
2
|
if (!(instance instanceof Constructor)) {
|
|
15
3
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -152,13 +140,23 @@ function _createSuper(Derived) {
|
|
|
152
140
|
};
|
|
153
141
|
}
|
|
154
142
|
|
|
155
|
-
|
|
143
|
+
// `${src}::${namespace}` 조합으로 캐싱하여 서로 다른 src/namespace 가 같은 캐시를 공유하지 않도록 합니다.
|
|
144
|
+
// (이전 구현은 module-level 단일 promise라 첫 호출만 기억되어, 두 번째 호출이 다른 src 를 전달해도
|
|
145
|
+
// 기존 promise 가 반환되던 문제가 있었습니다.)
|
|
146
|
+
var cache = new Map();
|
|
147
|
+
|
|
148
|
+
function cacheKey(src, namespace) {
|
|
149
|
+
return "".concat(src, "::").concat(namespace);
|
|
150
|
+
}
|
|
151
|
+
|
|
156
152
|
function loadScript(src, namespace) {
|
|
157
153
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
154
|
+
var key = cacheKey(src, namespace); // Return the cached Promise if it exists for this src/namespace combination
|
|
155
|
+
|
|
156
|
+
var hit = cache.get(key);
|
|
158
157
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return cachedPromise;
|
|
158
|
+
if (hit != null) {
|
|
159
|
+
return hit;
|
|
162
160
|
}
|
|
163
161
|
|
|
164
162
|
var promise = new Promise(function (resolve, reject) {
|
|
@@ -211,13 +209,32 @@ function loadScript(src, namespace) {
|
|
|
211
209
|
reject(error);
|
|
212
210
|
return;
|
|
213
211
|
}
|
|
214
|
-
}); // Reset the cache if the Promise is rejected
|
|
212
|
+
}); // Reset the cache entry if the Promise is rejected so the next call can retry
|
|
215
213
|
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
var cached = promise["catch"](function (error) {
|
|
215
|
+
cache["delete"](key);
|
|
218
216
|
return Promise.reject(error);
|
|
219
217
|
});
|
|
220
|
-
|
|
218
|
+
cache.set(key, cached);
|
|
219
|
+
return cached;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* 캐싱된 loadScript Promise 를 비웁니다.
|
|
223
|
+
*
|
|
224
|
+
* - 인자 없이 호출하면 전체 캐시를 비웁니다.
|
|
225
|
+
* - src 와 namespace 를 모두 전달하면 해당 조합의 캐시만 제거합니다.
|
|
226
|
+
*
|
|
227
|
+
* 외부 SDK 의 reset/cleanup 로직에서 namespace 와 script 를 함께 정리할 때 호출하여
|
|
228
|
+
* 다음 loadScript 호출이 stale promise 를 반환하지 않도록 합니다.
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
function clearCache(src, namespace) {
|
|
232
|
+
if (src != null && namespace != null) {
|
|
233
|
+
cache["delete"](cacheKey(src, namespace));
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
cache.clear();
|
|
221
238
|
}
|
|
222
239
|
|
|
223
240
|
function getNamespace(name) {
|
|
@@ -260,6 +277,13 @@ var ScriptLoadFailedError = /*#__PURE__*/function (_Error2) {
|
|
|
260
277
|
return ScriptLoadFailedError;
|
|
261
278
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
262
279
|
|
|
280
|
+
var SCRIPT_URL = 'https://js.tosspayments.com/v2/standard';
|
|
281
|
+
|
|
282
|
+
var NAMESPACE = 'TossPayments'; // loadTossPayments 가 시도한 (src, namespace) 를 모듈 내부에 추적하여, clearTossPayments 가
|
|
283
|
+
// 호출 시점에 정확히 동일한 스크립트와 sdk-loader 의 cache entry 를 정리할 수 있도록 합니다.
|
|
284
|
+
// key 는 src 만 사용 (namespace 는 현재 고정), 같은 src 의 중복 load 는 자연스럽게 dedupe 됩니다.
|
|
285
|
+
|
|
286
|
+
var loadedRequests = new Map();
|
|
263
287
|
function loadTossPayments(clientKey) {
|
|
264
288
|
var loadOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
265
289
|
var _loadOptions$src = loadOptions.src,
|
|
@@ -268,14 +292,44 @@ function loadTossPayments(clientKey) {
|
|
|
268
292
|
if (typeof window === 'undefined') {
|
|
269
293
|
// XXX(@HyunSeob): SSR할 때 생성자가 사용되는 경우 에러를 발생시키지 않는대신 정상적인 인스턴스를 반환하지 않는다.
|
|
270
294
|
return Promise.resolve({});
|
|
271
|
-
}
|
|
295
|
+
}
|
|
272
296
|
|
|
297
|
+
loadedRequests.set(src, {
|
|
298
|
+
src: src,
|
|
299
|
+
namespace: NAMESPACE
|
|
300
|
+
}); // regenerator-runtime 의존성을 없애기 위해 `async` 키워드를 사용하지 않는다
|
|
273
301
|
|
|
274
|
-
return loadScript(src,
|
|
302
|
+
return loadScript(src, NAMESPACE).then(function (TossPayments) {
|
|
275
303
|
return TossPayments(clientKey);
|
|
276
304
|
});
|
|
277
305
|
}
|
|
278
306
|
|
|
307
|
+
function clearTossPayments() {
|
|
308
|
+
var _defaultScript$parent;
|
|
309
|
+
|
|
310
|
+
if (typeof document === 'undefined' || typeof window === 'undefined') {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
loadedRequests.forEach(function (_ref) {
|
|
315
|
+
var _script$parentElement;
|
|
316
|
+
|
|
317
|
+
var src = _ref.src,
|
|
318
|
+
namespace = _ref.namespace;
|
|
319
|
+
var script = document.querySelector("script[src=\"".concat(src, "\"]"));
|
|
320
|
+
script === null || script === void 0 ? void 0 : (_script$parentElement = script.parentElement) === null || _script$parentElement === void 0 ? void 0 : _script$parentElement.removeChild(script);
|
|
321
|
+
clearCache(src, namespace);
|
|
322
|
+
});
|
|
323
|
+
loadedRequests.clear(); // fallback: loadTossPayments 를 거치지 않고 HTML inline / SSR / 다른 코드 경로로 직접 inject 된
|
|
324
|
+
// default SCRIPT_URL 스크립트도 함께 정리합니다. (기존 동작 호환)
|
|
325
|
+
|
|
326
|
+
var defaultScript = document.querySelector("script[src=\"".concat(SCRIPT_URL, "\"]"));
|
|
327
|
+
defaultScript === null || defaultScript === void 0 ? void 0 : (_defaultScript$parent = defaultScript.parentElement) === null || _defaultScript$parent === void 0 ? void 0 : _defaultScript$parent.removeChild(defaultScript); // TODO: public interface에서 TossPayments의 global declaration 추가한 뒤 제거 예정입니다
|
|
328
|
+
// @ts-ignore
|
|
329
|
+
|
|
330
|
+
delete window.TossPayments;
|
|
331
|
+
}
|
|
332
|
+
|
|
279
333
|
var ANONYMOUS = '@@ANONYMOUS';
|
|
280
334
|
|
|
281
335
|
export { ANONYMOUS, clearTossPayments, loadTossPayments };
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tosspayments/tosspayments-sdk",
|
|
3
3
|
"description": "TossPayments.js Tosspayments SDK.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.1",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./types/index.d.ts",
|
|
11
|
+
"import": "./dist/index.esm.js",
|
|
12
|
+
"require": "./dist/index.cjs.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
8
16
|
"author": "Toss Payments",
|
|
9
17
|
"repository": {
|
|
10
18
|
"type": "git",
|
|
@@ -25,8 +33,8 @@
|
|
|
25
33
|
"@rollup/plugin-babel": "^5.3.0",
|
|
26
34
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
27
35
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
28
|
-
"@tosspayments/sdk-loader": "workspace
|
|
29
|
-
"@tosspayments/standard-public-interfaces": "2.
|
|
36
|
+
"@tosspayments/sdk-loader": "workspace:^",
|
|
37
|
+
"@tosspayments/standard-public-interfaces": "2.9.0",
|
|
30
38
|
"happy-dom": "^14.12.3",
|
|
31
39
|
"prettier": "^2.0.2",
|
|
32
40
|
"rollup": "^2.60.0",
|
package/types/index.d.ts
CHANGED
|
@@ -443,6 +443,40 @@ interface WidgetPaymentRequestWindowOptions {
|
|
|
443
443
|
} | null;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
+
interface WidgetPaymentWindow {
|
|
447
|
+
/**
|
|
448
|
+
* 결제창의 이벤트를 구독합니다.
|
|
449
|
+
*
|
|
450
|
+
* @param {'paymentRequest'} eventName 구독할 이벤트입니다. `paymentRequest` 이벤트로 구매자의 결제 요청을 수신하세요.
|
|
451
|
+
* @param {function} callback 이벤트가 일어나면 호출되는 콜백 함수입니다.
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```javascript
|
|
455
|
+
* paymentWindow.on('paymentRequest', ({ paymentMethod }) => {
|
|
456
|
+
* // 결제 요청 처리
|
|
457
|
+
* });
|
|
458
|
+
* ```
|
|
459
|
+
*
|
|
460
|
+
* @throws {@link PublicError.Widgets.InvalidEventParameterError} eventName이 유효하지 않은 경우
|
|
461
|
+
* @throws {@link PublicError.Widgets.InvalidCallbackParameterError} callback이 유효하지 않은 경우
|
|
462
|
+
* @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
|
|
463
|
+
*/
|
|
464
|
+
on: (eventName: 'paymentRequest', callback: (params: {
|
|
465
|
+
paymentMethod: WidgetSelectedPaymentMethod;
|
|
466
|
+
}) => Promise<void>) => void;
|
|
467
|
+
/**
|
|
468
|
+
* 결제창을 제거합니다.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```javascript
|
|
472
|
+
* await paymentWindow.destroy();
|
|
473
|
+
* ```
|
|
474
|
+
*
|
|
475
|
+
* @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
|
|
476
|
+
*/
|
|
477
|
+
destroy: () => Promise<void>;
|
|
478
|
+
}
|
|
479
|
+
|
|
446
480
|
/**
|
|
447
481
|
* 결제 UI 위젯을 렌더링합니다
|
|
448
482
|
* @param {object} params 결제 UI 렌더링 정보입니다.
|
|
@@ -695,6 +729,46 @@ type RequestPaymentWindowWithPromise = (paymentRequest: WidgetPaymentRequestWind
|
|
|
695
729
|
*/
|
|
696
730
|
type RequestPaymentWindowWithRedirection = (paymentRequest: WithRedirection<WidgetPaymentRequestWindow>, options?: WidgetPaymentRequestWindowOptions) => Promise<void>;
|
|
697
731
|
|
|
732
|
+
/**
|
|
733
|
+
* 결제창을 렌더링합니다
|
|
734
|
+
* @param {object} params 결제창 렌더링 정보입니다.
|
|
735
|
+
*
|
|
736
|
+
* @returns 반환되는 결제창 객체로 아래 메서드를 호출할 수 있어요.
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* ```javascript
|
|
740
|
+
* const paymentWindow = await widgets.renderPaymentWindow({
|
|
741
|
+
* variantKey: {
|
|
742
|
+
* paymentMethod: "CUSTOM-1",
|
|
743
|
+
* agreement: "AGREEMENT",
|
|
744
|
+
* },
|
|
745
|
+
* });
|
|
746
|
+
* ```
|
|
747
|
+
*
|
|
748
|
+
* @throws {@link PublicError.Widgets.PaymentWindowAlreadyRenderedError} 이미 결제창이 렌더링 된 경우
|
|
749
|
+
* @throws {@link PublicError.Widgets.UserCancelError} 사용자가 결제창 렌더링을 취소한 경우
|
|
750
|
+
* @throws {@link PublicError.Widgets.NotSetupAmountError} 결제금액이 설정되지 않은 경우
|
|
751
|
+
* @throws {@link PublicError.Widgets.InvalidVariantKeyError} variantKey가 유효하지 않은 경우
|
|
752
|
+
* @throws {@link PublicError.Widgets.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
|
|
753
|
+
* @throws {@link PublicError.Widgets.InvalidParametersError} 파라미터가 올바르지 않은 경우
|
|
754
|
+
* @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
|
|
755
|
+
*/
|
|
756
|
+
type RenderPaymentWindow = (params?: {
|
|
757
|
+
/**
|
|
758
|
+
* 결제위젯 UI의 variantKey 정보입니다. [결제위젯 어드민](https://dashboard.tosspayments.com/payment-widget-service/)에서 확인할 수 있어요.
|
|
759
|
+
*/
|
|
760
|
+
variantKey?: {
|
|
761
|
+
/**
|
|
762
|
+
* 결제수단 UI의 variantKey입니다.
|
|
763
|
+
*/
|
|
764
|
+
paymentMethod?: string;
|
|
765
|
+
/**
|
|
766
|
+
* 약관 UI의 variantKey입니다.
|
|
767
|
+
*/
|
|
768
|
+
agreement?: string;
|
|
769
|
+
};
|
|
770
|
+
}) => Promise<WidgetPaymentWindow>;
|
|
771
|
+
|
|
698
772
|
interface TossPaymentsWidgets {
|
|
699
773
|
/**
|
|
700
774
|
* 주문의 결제 금액을 설정합니다. [자세히 >](#widgetssetamount)
|
|
@@ -709,13 +783,20 @@ interface TossPaymentsWidgets {
|
|
|
709
783
|
*/
|
|
710
784
|
requestPayment: RequestPayment$2;
|
|
711
785
|
/**
|
|
786
|
+
*
|
|
712
787
|
* 위젯 결제창으로 결제를 요청합니다. [자세히 >](#widgetsrequestpaymentwindow)
|
|
788
|
+
* @deprecated renderPaymentWindow API로 대체됩니다.
|
|
789
|
+
* @ignore
|
|
713
790
|
*/
|
|
714
791
|
requestPaymentWindow: RequestPaymentWindow;
|
|
715
792
|
/**
|
|
716
793
|
* 약관 UI를 렌더링합니다. [자세히 >](#widgetsrenderagreement)
|
|
717
794
|
*/
|
|
718
795
|
renderAgreement: RenderAgreement;
|
|
796
|
+
/**
|
|
797
|
+
* 결제창을 렌더링합니다. [자세히 >](#widgetsrenderpaymentwindow)
|
|
798
|
+
*/
|
|
799
|
+
renderPaymentWindow: RenderPaymentWindow;
|
|
719
800
|
}
|
|
720
801
|
|
|
721
802
|
interface BrandpayAmount extends Amount {
|
|
@@ -1391,6 +1472,10 @@ interface TransferPaymentRequest extends PaymentRequest {
|
|
|
1391
1472
|
* 문화비(도서, 공연 티켓, 박물관·미술관 입장권 등) 지출 여부입니다.
|
|
1392
1473
|
*/
|
|
1393
1474
|
isCulturalExpenses?: boolean | null;
|
|
1475
|
+
/**
|
|
1476
|
+
* @ignore
|
|
1477
|
+
*/
|
|
1478
|
+
encryptedCustomerCi?: string | null;
|
|
1394
1479
|
} | null;
|
|
1395
1480
|
}
|
|
1396
1481
|
|
|
@@ -1418,9 +1503,9 @@ interface ForeignEasyPayPaymentRequest extends PaymentRequest {
|
|
|
1418
1503
|
*/
|
|
1419
1504
|
foreignEasyPay: {
|
|
1420
1505
|
/**
|
|
1421
|
-
* 해외간편결제 코드입니다. 현재는 `PAYPAL`만 지원하고 있어요.
|
|
1506
|
+
* 해외간편결제 코드입니다. 현재는 `PAYPAL`, `PAYPAY`만 지원하고 있어요.
|
|
1422
1507
|
*/
|
|
1423
|
-
provider: 'PAYPAL' | 'GCASH' | 'TOUCHNGO' | 'BOOST' | 'BPI' | 'BILLEASE' | 'DANA' | 'ALIPAYHK' | 'TRUEMONEY' | 'RABBIT_LINE_PAY' | 'ALIPAY';
|
|
1508
|
+
provider: 'PAYPAL' | 'GCASH' | 'TOUCHNGO' | 'BOOST' | 'BPI' | 'BILLEASE' | 'DANA' | 'ALIPAYHK' | 'TRUEMONEY' | 'RABBIT_LINE_PAY' | 'ALIPAY' | 'PAYPAY';
|
|
1424
1509
|
/**
|
|
1425
1510
|
* 구매자가 위치한 국가입니다. ISO-3166의 두 자리 국가 코드를 입력하세요.
|
|
1426
1511
|
*/
|
|
@@ -1595,6 +1680,15 @@ interface TransferBillingAuthRequest extends BaseBillingAuthRequest {
|
|
|
1595
1680
|
* 자동결제(빌링)에 등록할 결제수단입니다.
|
|
1596
1681
|
*/
|
|
1597
1682
|
method: 'TRANSFER';
|
|
1683
|
+
/**
|
|
1684
|
+
* @ignore
|
|
1685
|
+
*/
|
|
1686
|
+
transfer?: {
|
|
1687
|
+
/**
|
|
1688
|
+
* @ignore
|
|
1689
|
+
*/
|
|
1690
|
+
encryptedCustomerCi?: string | null;
|
|
1691
|
+
} | null;
|
|
1598
1692
|
}
|
|
1599
1693
|
/**
|
|
1600
1694
|
* 자동결제(빌링) 등록 요청 정보입니다. 토스페이먼츠 자동결제는 신용·체크카드, 계좌이체를 지원해요.
|