@tosspayments/tosspayments-sdk 2.2.4 → 2.3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.3.1](https://github.com/tosspayments/browser-sdk/compare/@tosspayments/tosspayments-sdk@2.3.0...@tosspayments/tosspayments-sdk@2.3.1) (2024-09-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **tosspayments-sdk:** @tosspayments/standard-public-interfaces 버전업 ([#125](https://github.com/tosspayments/browser-sdk/issues/125)) ([923d41f](https://github.com/tosspayments/browser-sdk/commit/923d41fd79bc41304ef08f553d98c09b76db6650))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.3.0](https://github.com/tosspayments/browser-sdk/compare/@tosspayments/tosspayments-sdk@2.2.4...@tosspayments/tosspayments-sdk@2.3.0) (2024-09-03)
18
+
19
+
20
+ ### Features
21
+
22
+ * @tosspayments/standard-public-interfaces 버전업 ([#121](https://github.com/tosspayments/browser-sdk/issues/121)) ([985e51c](https://github.com/tosspayments/browser-sdk/commit/985e51c172248a68803cc28538aa3a609bda85ee))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [2.2.4](https://github.com/tosspayments/browser-sdk/compare/@tosspayments/tosspayments-sdk@2.2.3...@tosspayments/tosspayments-sdk@2.2.4) (2024-07-23)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tosspayments/tosspayments-sdk",
3
3
  "description": "TossPayments.js Tosspayments SDK.",
4
- "version": "2.2.4",
4
+ "version": "2.3.1",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
7
7
  "types": "types/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "@rollup/plugin-commonjs": "^21.0.1",
22
22
  "@rollup/plugin-typescript": "^8.3.0",
23
23
  "@tosspayments/sdk-loader": "2.0.1",
24
- "@tosspayments/standard-public-interfaces": "2.0.7",
24
+ "@tosspayments/standard-public-interfaces": "2.0.20",
25
25
  "happy-dom": "^14.12.3",
26
26
  "prettier": "^2.0.2",
27
27
  "rollup": "^2.60.0",
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "e9ddfc2f54498c25c9c7ffa621e933ab26fc3a8c"
41
+ "gitHead": "a7b40fa8e970d261b4c3b925191ba023195606d7"
42
42
  }
package/types/index.d.ts CHANGED
@@ -131,6 +131,10 @@ interface WidgetPaymentRequest {
131
131
  * 결제 금액 중 면세 금액입니다. 면세 상점 혹은 복합 과세 상점으로 계약된 상점만 사용하세요. 자세한 내용은 세금 처리 가이드에서 확인하세요.
132
132
  */
133
133
  taxFreeAmount?: number;
134
+ /**
135
+ * 결제 관련 정보를 추가할 수 있는 객체입니다. 최대 5개의 키-값(key-value) 쌍을 자유롭게 추가해주세요. 키는 `[` , `]` 를 사용하지 않는 최대 40자의 문자열, 값은 최대 500자의 문자열입니다.
136
+ */
137
+ metadata?: Record<string | symbol | number, unknown> | null;
134
138
  /**
135
139
  * 구매자가 카드를 선택하면 결제에 적용되는 옵션입니다.
136
140
  */
@@ -416,6 +420,7 @@ type RenderAgreement = (params: {
416
420
 
417
421
  /**
418
422
  * 결제를 요청합니다
423
+ * @docsDefaultSignature RequestPaymentWithRedirection
419
424
  *
420
425
  * @param {WidgetPaymentRequest} paymentRequest - 결제 요청 정보입니다.
421
426
  *
@@ -437,7 +442,9 @@ type RenderAgreement = (params: {
437
442
  * @throws {@link PublicError.Widgets.NotSupportedPromiseError} promise 방식을 지원하지 않는 환경인 경우
438
443
  * @throws {@link PublicError.Widgets.CustomPaymentMethodUnableToPayError} 커스텀 결제수단이 선택된 상태에서 결제요청을 한 경우
439
444
  * @throws {@link PublicError.Widgets.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
445
+ * @throws {@link PublicError.Widgets.InvalidMetadataError} metadata가 올바르지 않은 경우
440
446
  * @throws {@link PublicError.Widgets.InvalidParametersError} 파라미터가 올바르지 않은 경우
447
+ * @throws {@link PublicError.Widgets.BelowZeroAmountError} 결제 금액이 0원 미만인 경우
441
448
  * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
442
449
  */
443
450
  type RequestPayment$2 = RequestPaymentWithPromise$1 & RequestPaymentWithRedirection$1;
@@ -504,7 +511,6 @@ type RequestPaymentWithRedirection$1 = (paymentRequest: WithRedirection<WidgetPa
504
511
  *
505
512
  * @throws {@link PublicError.Widgets.InvalidAmountValueError} 결제 금액이 유효하지 않은 경우
506
513
  * @throws {@link PublicError.Widgets.InvalidAmountCurrencyError} 결제 금액의 통화가 유효하지 않은 경우
507
- * @throws {@link PublicError.Widgets.BelowZeroAmountError} 결제 금액이 0원 이하인 경우
508
514
  * @throws {@link PublicError.Widgets.InvalidParametersError} 파라미터가 올바르지 않은 경우
509
515
  * @throws {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
510
516
  */
@@ -561,6 +567,10 @@ interface BrandpayPaymentRequest {
561
567
  * 결제 금액 중 면세 금액입니다. 면세 상점 혹은 복합 과세 상점으로 계약된 상점만 사용하세요. 자세한 내용은 세금 처리 가이드에서 확인하세요.
562
568
  */
563
569
  taxFreeAmount?: number;
570
+ /**
571
+ * 결제 관련 정보를 추가할 수 있는 객체입니다. 최대 5개의 키-값(key-value) 쌍을 자유롭게 추가해주세요. 키는 `[` , `]` 를 사용하지 않는 최대 40자의 문자열, 값은 최대 500자의 문자열입니다.
572
+ */
573
+ metadata?: Record<string | symbol | number, unknown> | null;
564
574
  }
565
575
 
566
576
  interface BrandpayRequestPaymentResult {
@@ -580,18 +590,20 @@ interface BrandpayRequestPaymentResult {
580
590
 
581
591
  /**
582
592
  * 결제를 요청합니다
593
+ * @docsDefaultSignature RequestPaymentWithRedirection
583
594
  *
584
595
  * @param {WithRedirection<BrandpayPaymentRequest> | BrandpayPaymentRequest} paymentRequest - 결제 요청 정보
585
596
  *
586
597
  *
587
598
  * @throws {@link PublicError.Brandpay.UserCancelError} 사용자가 결제를 취소한 경우
588
599
  * @throws {@link PublicError.Brandpay.InvalidAmountValueError} 결제 금액이 유효하지 않은 경우
589
- * @throws {@link PublicError.Brandpay.BelowZeroAmountError} 결제 금액이 0 미만인 경우
600
+ * @throws {@link PublicError.Brandpay.BelowZeroAmountError} 결제 금액이 0원 미만인 경우
590
601
  * @throws {@link PublicError.Brandpay.IncorrectSuccessUrlFormatError} successUrl이 유효하지 않은 경우
591
602
  * @throws {@link PublicError.Brandpay.IncorrectFailUrlFormatError} failUrl이 유효하지 않은 경우
592
603
  * @throws {@link PublicError.Brandpay.PaymentRequestFailError} 결제 요청에 실패한 경우
593
604
  * @throws {@link PublicError.Brandpay.NotRegisteredRedirectUrlError} redirectUrl이 등록되지 않은 경우
594
605
  * @throws {@link PublicError.Brandpay.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
606
+ * @throws {@link PublicError.Brandpay.InvalidMetadataError} metadata가 올바르지 않은 경우
595
607
  * @throws {@link PublicError.Brandpay.InvalidParametersError} 파라미터가 올바르지 않은 경우
596
608
  * @throws {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
597
609
  */
@@ -808,11 +820,15 @@ interface PaymentRequest {
808
820
  */
809
821
  taxFreeAmount?: number;
810
822
  /**
811
- * 결제창이 열리는 프레임입니다.
812
- * `iframe` 또는 현재 브라우저 화면(`self`)에서 결제창을 열 수 있어요. 기본 값은 `iframe`입니다.
813
- * 모바일 웹에서는 `windowTarget` 값이 작동하지 않고 화면이 이동합니다.
823
+ * 브라우저에서 결제창이 열리는 프레임입니다. `self`, `iframe` 중 하나입니다.
824
+ * \- `self`는 현재 브라우저를 결제창으로 이동시켜요. 모바일 환경에서 기본 값입니다.
825
+ * \- `iframe`은 iframe에서 결제창이 열려요. PC 환경에서 기본 값입니다. **모바일 환경에서는 `iframe`을 사용할 수 없습니다.**
814
826
  */
815
827
  windowTarget?: 'iframe' | 'self';
828
+ /**
829
+ * 결제 관련 정보를 추가할 수 있는 객체입니다. 최대 5개의 키-값(key-value) 쌍을 자유롭게 추가해주세요. 키는 `[` , `]` 를 사용하지 않는 최대 40자의 문자열, 값은 최대 500자의 문자열입니다.
830
+ */
831
+ metadata?: Record<string | symbol | number, unknown> | null;
816
832
  }
817
833
 
818
834
  interface CardPaymentRequest extends PaymentRequest {
@@ -921,6 +937,10 @@ interface CardPaymentRequest extends PaymentRequest {
921
937
  */
922
938
  quantity?: number;
923
939
  }>;
940
+ /**
941
+ * 해외카드(Visa, MasterCard, JCB, UnionPay 등) 결제 여부입니다. `true`로 설정하면 해외카드 결제가 가능한 [다국어 결제창](/resources/glossary/payment-window#다국어-결제창)이 열립니다.
942
+ */
943
+ useInternationalCardOnly?: boolean;
924
944
  };
925
945
  }
926
946
 
@@ -1205,9 +1225,9 @@ interface BillingAuthRequest {
1205
1225
  */
1206
1226
  customerEmail?: string;
1207
1227
  /**
1208
- * 결제창이 열리는 프레임입니다.
1209
- * `iframe` 또는 현재 브라우저 화면(`self`)에서 등록창을 열 수 있어요. 기본 값은 `iframe`입니다.
1210
- * 모바일 웹에서는 `windowTarget` 값이 작동하지 않고 화면이 이동합니다.
1228
+ * 브라우저에서 결제창이 열리는 프레임입니다. `self`, `iframe` 중 하나입니다.
1229
+ * \- `self`는 현재 브라우저를 결제창으로 이동시켜요. 모바일 환경에서 기본 값입니다.
1230
+ * \- `iframe`은 iframe에서 결제창이 열려요. PC 환경에서 기본 값입니다. **모바일 환경에서는 `iframe`을 사용할 수 없습니다.**
1211
1231
  *
1212
1232
  * @default 'iframe'
1213
1233
  */
@@ -1219,13 +1239,14 @@ interface BillingAuthRequest {
1219
1239
  * @throws {@link PublicError.Payment.UserCancelError} 사용자가 결제창을 닫은 경우
1220
1240
  * @throws {@link PublicError.Payment.InvalidAmountValueError} 결제 금액이 유효하지 않은 경우
1221
1241
  * @throws {@link PublicError.Payment.InvalidAmountCurrencyError} 결제 금액의 통화가 유효하지 않은 경우
1222
- * @throws {@link PublicError.Payment.BelowZeroAmountError} 결제 금액이 0 미만인 경우
1242
+ * @throws {@link PublicError.Payment.BelowZeroAmountError} 결제 금액이 0원 미만인 경우
1223
1243
  * @throws {@link PublicError.Payment.NotSupportedPromiseError} promise 방식을 지원하지 않는 환경인 경우
1224
1244
  * @throws {@link PublicError.Payment.NotSupportedMethodError} 가맹점에서 정의되지 않은 method를 넘겨준 경우
1225
1245
  * @throws {@link PublicError.Payment.IncorrectSuccessUrlFormatError} 가맹점에서 유효하지 않은 successUrl을 넘겨준 경우
1226
1246
  * @throws {@link PublicError.Payment.IncorrectFailUrlFormatError} 가맹점에서 유효하지 않은 failUrl을 넘겨준 경우
1227
1247
  * @throws {@link PublicError.Payment.PaymentRequestFailError} 결제에 실패한 경우
1228
1248
  * @throws {@link PublicError.Payment.InvalidMethodTransactionError} 이미 다른 명령을 수행 중인 경우
1249
+ * @throws {@link PublicError.Payment.InvalidMetadataError} metadata가 올바르지 않은 경우
1229
1250
  * @throws {@link PublicError.Payment.InvalidParametersError} 파라미터가 올바르지 않은 경우
1230
1251
  * @throws {@link PublicError.Payment.UnknownError} 알 수 없는 오류가 발생한 경우
1231
1252
  */
@@ -1619,12 +1640,8 @@ type RequestForeignEasyPayPaymentWithRedirection = (paymentRequest: WithRedirect
1619
1640
  * ```javascript
1620
1641
  * payment.requestBillingAuth({
1621
1642
  * method: 'CARD',
1622
- * amount: {
1623
- * currency: 'KRW',
1624
- * value: 50000,
1625
- * },
1626
- * successUrl: window.location.origin + '/payment/billing.html',
1627
- * failUrl: window.location.origin + '/fail.html',
1643
+ * successUrl: window.location.origin + '/payment/billing',
1644
+ * failUrl: window.location.origin + '/fail',
1628
1645
  * customerEmail: 'customer123@gmail.com',
1629
1646
  * customerName: '김토스',
1630
1647
  * });
@@ -1657,7 +1674,8 @@ interface TossPaymentsSDK {
1657
1674
  *
1658
1675
  * @throw {@link PublicError.Widgets.InvalidClientKeyError} clientKey가 올바르지 않은 경우
1659
1676
  * @throw {@link PublicError.Widgets.InvalidCustomerKeyError} customerKey가 올바르지 않은 경우
1660
- * @throw {@link PublicError.Widgets.WidgetsSDKInitializeConflictError} widgets SDK 초기화 중 충돌이 발생한 경우
1677
+ * @throw {@link PublicError.Widgets.InsecureKeyUsageError} customerKey에 시크릿키를 사용한 경우
1678
+ * @throw {@link PublicError.Widgets.NotSupportedAPIIndividualKeyError} API 개별 연동 키를 clientKey로 사용한 경우
1661
1679
  * @throw {@link PublicError.Widgets.UnknownError} 알 수 없는 오류가 발생한 경우
1662
1680
  * @returns 아래 메서드를 호출할 수 있는 결제위젯 객체를 반환합니다.
1663
1681
  * @example
@@ -1681,7 +1699,8 @@ interface TossPaymentsSDK {
1681
1699
  *
1682
1700
  * @throw {@link PublicError.Brandpay.InvalidClientKeyError} clientKey가 올바르지 않은 경우
1683
1701
  * @throw {@link PublicError.Brandpay.InvalidCustomerKeyError} customerKey가 올바르지 않은 경우
1684
- * @throw {@link PublicError.Brandpay.BrandpaySDKInitializeConflictError} 브랜드페이 SDK 초기화 중 충돌이 발생한 경우
1702
+ * @throw {@link PublicError.Brandpay.InsecureKeyUsageError} customerKey에 시크릿키를 사용한 경우
1703
+ * @throw {@link PublicError.Brandpay.NotSupportedWidgetKeyError} 결제위젯 연동 키를 clientKey로 사용한 경우
1685
1704
  * @throw {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
1686
1705
  * @example
1687
1706
  * ```javascript
@@ -1700,8 +1719,9 @@ interface TossPaymentsSDK {
1700
1719
  *
1701
1720
  * @throw {@link PublicError.Payment.InvalidClientKeyError} clientKey가 올바르지 않은 경우
1702
1721
  * @throw {@link PublicError.Payment.InvalidCustomerKeyError} customerKey가 올바르지 않은 경우
1703
- * @throw {@link PublicError.Payment.PaymentSDKInitializeConflictError} payment SDK 초기화 중 충돌이 발생한 경우
1704
- * @throw {@link PublicError.Brandpay.UnknownError} 알 수 없는 오류가 발생한 경우
1722
+ * @throw {@link PublicError.Payment.InsecureKeyUsageError} customerKey에 시크릿키를 사용한 경우
1723
+ * @throw {@link PublicError.Payment.NotSupportedWidgetKeyError} 결제위젯 연동 키를 clientKey로 사용한 경우
1724
+ * @throw {@link PublicError.Payment.UnknownError} 알 수 없는 오류가 발생한 경우
1705
1725
  * @example
1706
1726
  * ```javascript
1707
1727
  * const payment = tossPayments.payment({ customerKey });
@@ -1716,7 +1736,8 @@ interface TossPaymentsSDK {
1716
1736
  * @example
1717
1737
  * ```javascript
1718
1738
  * // 스크립트 태그 연동방식
1719
- * const tossPayments = TossPayments("<WidgetClientKey />");
1739
+ * const tossPayments = TossPayments("<WidgetClientKey />"); // 결제위젯 연동 키
1740
+ * const tossPayments = TossPayments("<ClientKey />"); // API 개별 연동 키
1720
1741
  *
1721
1742
  * // 모듈 임포트 연동방식
1722
1743
  * import { loadTossPayments } from "@tosspayments/tosspayments-sdk"
@@ -1725,7 +1746,7 @@ interface TossPaymentsSDK {
1725
1746
  *
1726
1747
  * @param {string} clientKey 토스페이먼츠 발급하는 클라이언트 키입니다. 개발자센터의 [API 키 메뉴](https://developers.tosspayments.com/my/api-keys)에서 확인할 수 있어요.
1727
1748
  *
1728
- * 결제위젯을 연동한다면 [결제위젯 연동 키](/reference/using-api/api-keys#결제위젯-연동-키)를 사용하세요. 결제창, 자동결제(빌링)을 연동한다면 [API 개별 연동 키](/reference/using-api/api-keys#api-개별-연동-키)를 사용하세요.
1749
+ * 결제위젯을 연동한다면 [결제위젯 연동 키](/reference/using-api/api-keys#결제위젯-연동-키)를 사용하세요. 브랜드페이, 결제창, 자동결제(빌링)를 연동한다면 [API 개별 연동 키](/reference/using-api/api-keys#api-개별-연동-키)를 사용하세요.
1729
1750
  *
1730
1751
  * @returns
1731
1752
  * 아래 메서드를 호출할 수 있는 토스페이먼츠 객체를 반환합니다.