@apps-in-toss/native-modules 1.1.2 → 1.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/dist/index.d.cts CHANGED
@@ -231,24 +231,12 @@ interface ContactsViralParams {
231
231
  */
232
232
  declare function contactsViral(params: ContactsViralParams): () => void;
233
233
 
234
- declare class BackButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
235
- name: "backButtonClickEvent";
236
- remove(): void;
237
- listener(_: undefined): void;
238
- }
239
-
240
234
  declare class EntryMessageExitedEvent extends GraniteEventDefinition<undefined, undefined> {
241
235
  name: "entryMessageExited";
242
236
  remove(): void;
243
237
  listener(_: undefined): void;
244
238
  }
245
239
 
246
- declare class HomeIconButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
247
- name: "homeIconButtonClickEvent";
248
- remove(): void;
249
- listener(_: undefined): void;
250
- }
251
-
252
240
  interface StartUpdateLocationOptions {
253
241
  /**
254
242
  * 위치 정확도를 설정해요.
@@ -298,7 +286,7 @@ declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEvent
298
286
  private isVisibilityChangedByTransparentServiceWebResult;
299
287
  }
300
288
 
301
- declare const appsInTossEvent: GraniteEvent<BackButtonClickHandleEvent | EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
289
+ declare const appsInTossEvent: GraniteEvent<EntryMessageExitedEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
302
290
 
303
291
  declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
304
292
  options: {
@@ -1423,16 +1411,16 @@ type GameCenterGameProfileResponse = {
1423
1411
  */
1424
1412
  declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
1425
1413
 
1426
- /**
1427
- * @public
1428
- * @category 인앱결제
1429
- * @name IapCreateOneTimePurchaseOrderOptions
1430
- * @description 인앱결제 1건을 요청할 때 필요한 정보예요.
1431
- * @property {string} productId - 주문할 상품의 ID예요.
1432
- */
1433
- interface IapCreateOneTimePurchaseOrderOptions {
1414
+ type Sku = {
1415
+ /**
1416
+ * @deprecated `productId`는 더 이상 사용하지 않아요. 대신 `sku`를 사용해요.
1417
+ */
1434
1418
  productId: string;
1435
- }
1419
+ sku?: string;
1420
+ } | {
1421
+ productId?: never;
1422
+ sku: string;
1423
+ };
1436
1424
  /**
1437
1425
  * @public
1438
1426
  * @category 인앱결제
@@ -1455,15 +1443,54 @@ interface IapCreateOneTimePurchaseOrderResult {
1455
1443
  fraction: number;
1456
1444
  miniAppIconUrl: string | null;
1457
1445
  }
1446
+ interface SuccessEvent {
1447
+ type: 'success';
1448
+ data: IapCreateOneTimePurchaseOrderResult;
1449
+ }
1450
+ interface PurchasedEvent {
1451
+ type: 'purchased';
1452
+ data: {
1453
+ orderId: string;
1454
+ };
1455
+ }
1458
1456
  /**
1459
1457
  * @public
1460
1458
  * @category 인앱결제
1461
- * @name iapCreateOneTimePurchaseOrder
1459
+ * @name IapCreateOneTimePurchaseOrderOptions
1460
+ * @property {Sku} options - 결제할 상품의 정보예요.
1461
+ * @property {string} options.sku - 주문할 상품의 고유 ID예요.
1462
+ * @property {(params: { orderId: string }) => boolean | Promise<boolean>} processProductGrant - 주문이 만들어진 뒤 실제로 상품을 지급할 때 호출해요. `orderId`를 받아서 지급 성공 여부를 `true` 또는 `Promise<true>`로 반환해요. 지급에 실패하면 `false`를 반환해요.
1463
+ * @property {(event: SuccessEvent) => void | Promise<void>} onEvent - 결제가 성공했을 때 호출해요. `event.type`이 `'success'`이고, `event.data`에 `IapCreateOneTimePurchaseOrderResult`가 들어 있어요.
1464
+ * @property {(error: unknown) => void | Promise<void>} onError - 결제 과정에서 에러가 발생했을 때 호출해요. 에러 객체를 받아서 로깅하거나 복구 절차를 실행할 수 있어요.
1465
+ */
1466
+ interface IapCreateOneTimePurchaseOrderOptions {
1467
+ options: Sku & {
1468
+ processProductGrant: (params: {
1469
+ orderId: string;
1470
+ }) => boolean | Promise<boolean>;
1471
+ };
1472
+ onEvent: (event: SuccessEvent) => void | Promise<void>;
1473
+ onError: (error: unknown) => void | Promise<void>;
1474
+ }
1475
+ interface IapRequestOneTimePurchaseOptions {
1476
+ options: Sku;
1477
+ onEvent: (event: PurchasedEvent | SuccessEvent) => void | Promise<void>;
1478
+ onError: (error: unknown) => void | Promise<void>;
1479
+ }
1480
+ declare function iapCreateOneTimePurchaseOrder(params: Sku): Promise<IapCreateOneTimePurchaseOrderResult>;
1481
+ declare function processProductGrant(params: {
1482
+ orderId: string;
1483
+ isProductGranted: boolean;
1484
+ }): Promise<void>;
1485
+ declare function requestOneTimePurchase(params: IapRequestOneTimePurchaseOptions): () => void;
1486
+ /**
1487
+ * @public
1488
+ * @category 인앱결제
1489
+ * @name createOneTimePurchaseOrder
1462
1490
  * @description
1463
1491
  * 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
1464
1492
  * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
1465
- * @param {string} params.productId - 주문할 상품의 ID예요.
1466
- * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
1493
+ * @returns {() => void} 앱브릿지 cleanup 함수를 반환해요. 인앱결제 기능이 끝나면 반드시 이 함수를 호출해서 리소스를 해제해야 해요.
1467
1494
  *
1468
1495
  * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
1469
1496
  * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
@@ -1475,41 +1502,53 @@ interface IapCreateOneTimePurchaseOrderResult {
1475
1502
  * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1476
1503
  * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
1477
1504
  * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
1505
+ * @throw {code: "PRODUCT_NOT_GRANTED_BY_PARTNER"} - 파트너사의 상품 지급이 실패했을 때 발생해요.
1478
1506
  *
1479
1507
  * @example
1480
1508
  * ### 특정 인앱결제 주문서 페이지로 이동하기
1481
1509
  *
1482
1510
  * ```tsx
1483
1511
  * import { IAP } from "@apps-in-toss/web-framework";
1484
- * import { Button } from "@toss-design-system/react-native";
1512
+ * import { Button } from "@toss/tds-react-native";
1513
+ * import { useCallback } from "react";
1485
1514
  *
1486
1515
  * interface Props {
1487
- * productId: string;
1516
+ * sku: string;
1488
1517
  * }
1489
1518
  *
1490
- * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1491
- * async function handleClick() {
1492
- * try {
1493
- * await IAP.createOneTimePurchaseOrder({
1494
- * productId,
1495
- * });
1496
- * console.error("인앱결제에 성공했어요");
1497
- * } catch (error) {
1498
- * console.error('인앱결제에 실패했어요:', error);
1499
- * }
1500
- * }
1519
+ * function IapCreateOneTimePurchaseOrderButton({ sku }: Props) {
1520
+ * const handleClick = useCallback(async () => {
1521
+ *
1522
+ * const cleanup = await IAP.createOneTimePurchaseOrder({
1523
+ * options: {
1524
+ * sku,
1525
+ * processProductGrant: ({ orderId }) => {
1526
+ * // 상품 지급 로직 작성
1527
+ * return true; // 상품 지급 여부
1528
+ * }
1529
+ * },
1530
+ * onEvent: (event) => {
1531
+ * console.log(event);
1532
+ * },
1533
+ * onError: (error) => {
1534
+ * console.error(error);
1535
+ * },
1536
+ * });
1537
+ *
1538
+ * return cleanup;
1539
+ * }, []);
1501
1540
  *
1502
1541
  * return <Button onClick={handleClick}>구매하기</Button>;
1503
1542
  * }
1504
1543
  * ```
1505
1544
  */
1506
- declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): Promise<IapCreateOneTimePurchaseOrderResult | undefined>;
1545
+ declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): () => void;
1507
1546
  /**
1508
1547
  * @public
1509
1548
  * @category 인앱결제
1510
1549
  * @name IapProductListItem
1511
1550
  * @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
1512
- * @property {string} sku - 상품의 고유 ID예요. [IAP.createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html)를 호출할때 사용하는 `productId`와 동일한 값이에요.
1551
+ * @property {string} sku - 상품의 고유 ID예요.
1513
1552
  * @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
1514
1553
  * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1515
1554
  * @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
@@ -1525,7 +1564,7 @@ interface IapProductListItem {
1525
1564
  /**
1526
1565
  * @public
1527
1566
  * @category 인앱결제
1528
- * @name iapGetProductItemList
1567
+ * @name getProductItemList
1529
1568
  * @description 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 상품 목록 화면에 진입할 때 호출해요.
1530
1569
  * @returns {Promise<{ products: IapProductListItem[] } | undefined>} 상품 목록을 포함한 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 `undefined`를 반환해요.
1531
1570
  *
@@ -1534,7 +1573,7 @@ interface IapProductListItem {
1534
1573
  *
1535
1574
  * ```tsx
1536
1575
  * import { IAP, IapProductListItem } from "@apps-in-toss/framework";
1537
- * import { Button, List, ListRow } from "@toss-design-system/react-native";
1576
+ * import { Button, List, ListRow } from "@toss/tds-react-native";
1538
1577
  * import { useEffect, useState } from "react";
1539
1578
  *
1540
1579
  * function IapProductList() {
@@ -1596,6 +1635,78 @@ interface IapProductListItem {
1596
1635
  declare function getProductItemList(): Promise<{
1597
1636
  products: IapProductListItem[];
1598
1637
  } | undefined>;
1638
+ /**
1639
+ * @public
1640
+ * @category 인앱결제
1641
+ * @name getPendingOrders
1642
+ * @description 대기 중인 주문 목록을 가져와요. 이 함수를 사용하면 결제가 아직 완료되지 않은 주문 정보를 확인할 수 있어요.
1643
+ * @returns {Promise<{orderIds: string[]}}>} 대기 중인 주문ID 배열을 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
1644
+ *
1645
+ * @example
1646
+ * ### 대기 중인 주문 목록 가져오기
1647
+ * ```typescript
1648
+ * import { IAP } from '@apps-in-toss/framework';
1649
+ *
1650
+ * async function fetchOrders() {
1651
+ * try {
1652
+ * const pendingOrders = await IAP.getPendingOrders();
1653
+ * return pendingOrders;
1654
+ * } catch (error) {
1655
+ * console.error(error);
1656
+ * }
1657
+ * }
1658
+ * ```
1659
+ */
1660
+ declare function getPendingOrders(): Promise<{
1661
+ orderIds: string[];
1662
+ } | undefined>;
1663
+ /**
1664
+ * @public
1665
+ * @category 인앱결제
1666
+ * @name CompletedOrRefundedOrdersResult
1667
+ * @description 인앱결제로 구매하거나 환불한 주문 목록을 나타내는 객체예요. 페이지네이션 정보를 포함해요.
1668
+ * @property {boolean} hasNext 다음 페이지가 있는지 여부예요. `true`면 더 많은 주문이 남아 있어요.
1669
+ * @property {string | null} [nextKey] 다음 주문 목록을 조회할 때 사용할 키예요. 마지막 페이지라면 `null`이거나 생략될 수 있어요.
1670
+ * @property {Array} orders 주문 정보를 담은 배열이에요. 각 요소는 하나의 주문을 나타내요.
1671
+ * @property {string} orders[].orderId 주문의 고유 ID예요.
1672
+ * @property {string} orders[].sku 주문 상품의 고유 ID예요.
1673
+ * @property {'COMPLETED' | 'REFUNDED'} orders[].status 주문의 상태예요. 'COMPLETED'는 주문이 완료된 상태, 'REFUNDED'는 환불된 상태를 의미해요.
1674
+ * @property {string} orders[].date 주문의 날짜 정보예요. ISO 8601 형식(YYYY-MM-DDTHH:mm:ss)을 사용해요. 예를 들어 "2025-09-22T00:00:00" 형식으로 제공돼요. 주문 상태가 `COMPLETED`라면 주문한 날짜를, `REFUNDED`라면 환불한 날짜를 나타내요.
1675
+ */
1676
+ interface CompletedOrRefundedOrdersResult {
1677
+ hasNext: boolean;
1678
+ nextKey?: string | null;
1679
+ orders: {
1680
+ orderId: string;
1681
+ sku: string;
1682
+ status: 'COMPLETED' | 'REFUNDED';
1683
+ date: string;
1684
+ }[];
1685
+ }
1686
+ /**
1687
+ * @public
1688
+ * @category 인앱결제
1689
+ * @name getCompletedOrRefundedOrders
1690
+ * @description 인앱결제로 구매하거나 환불한 주문 목록을 가져와요.
1691
+ * @returns {Promise<CompletedOrRefundedOrdersResult>} 페이지네이션을 포함한 주문 목록 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
1692
+ *
1693
+ * @example
1694
+ * ```typescript
1695
+ * import { IAP } from "@apps-in-toss/framework";
1696
+ *
1697
+ * async function fetchOrders() {
1698
+ * try {
1699
+ * const response = await IAP.getCompletedOrRefundedOrders();
1700
+ * return response;
1701
+ * } catch (error) {
1702
+ * console.error(error);
1703
+ * }
1704
+ * }
1705
+ * ```
1706
+ */
1707
+ declare function getCompletedOrRefundedOrders(params?: {
1708
+ key?: string | null;
1709
+ }): Promise<CompletedOrRefundedOrdersResult | undefined>;
1599
1710
  /**
1600
1711
  * @public
1601
1712
  * @category 인앱결제
@@ -1607,6 +1718,8 @@ declare function getProductItemList(): Promise<{
1607
1718
  declare const IAP: {
1608
1719
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
1609
1720
  getProductItemList: typeof getProductItemList;
1721
+ getPendingOrders: typeof getPendingOrders;
1722
+ getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
1610
1723
  };
1611
1724
 
1612
1725
  interface SaveBase64DataParams {
@@ -1773,10 +1886,30 @@ interface Spec extends TurboModule {
1773
1886
  }) => Promise<void>;
1774
1887
  saveBase64Data: (params: SaveBase64DataParams) => Promise<void>;
1775
1888
  /** IAP */
1776
- iapCreateOneTimePurchaseOrder: (params: IapCreateOneTimePurchaseOrderOptions) => Promise<IapCreateOneTimePurchaseOrderResult>;
1777
1889
  iapGetProductItemList: (arg: CompatiblePlaceholderArgument) => Promise<{
1778
1890
  products: IapProductListItem[];
1779
1891
  }>;
1892
+ /** @deprecated `requestOneTimePurchase`를 사용해주세요. */
1893
+ iapCreateOneTimePurchaseOrder: (params: {
1894
+ productId: string;
1895
+ }) => Promise<IapCreateOneTimePurchaseOrderResult>;
1896
+ requestOneTimePurchase: (params: {
1897
+ sku: string;
1898
+ }, fallbacks: {
1899
+ onPurchased: (params: {
1900
+ orderId: string;
1901
+ }) => void;
1902
+ }) => () => void;
1903
+ processProductGrant: (params: {
1904
+ orderId: string;
1905
+ isProductGranted: boolean;
1906
+ }) => Promise<void>;
1907
+ getPendingOrders: (params: CompatiblePlaceholderArgument) => Promise<{
1908
+ orderIds: string[];
1909
+ }>;
1910
+ getCompletedOrRefundedOrders: (params: {
1911
+ key?: string | null;
1912
+ }) => Promise<CompletedOrRefundedOrdersResult>;
1780
1913
  getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
1781
1914
  submitGameCenterLeaderBoardScore: (params: {
1782
1915
  score: string;
@@ -3195,4 +3328,4 @@ declare const INTERNAL__module: {
3195
3328
  tossCoreEventLog: typeof tossCoreEventLog;
3196
3329
  };
3197
3330
 
3198
- export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
3331
+ export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
package/dist/index.d.ts CHANGED
@@ -231,24 +231,12 @@ interface ContactsViralParams {
231
231
  */
232
232
  declare function contactsViral(params: ContactsViralParams): () => void;
233
233
 
234
- declare class BackButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
235
- name: "backButtonClickEvent";
236
- remove(): void;
237
- listener(_: undefined): void;
238
- }
239
-
240
234
  declare class EntryMessageExitedEvent extends GraniteEventDefinition<undefined, undefined> {
241
235
  name: "entryMessageExited";
242
236
  remove(): void;
243
237
  listener(_: undefined): void;
244
238
  }
245
239
 
246
- declare class HomeIconButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
247
- name: "homeIconButtonClickEvent";
248
- remove(): void;
249
- listener(_: undefined): void;
250
- }
251
-
252
240
  interface StartUpdateLocationOptions {
253
241
  /**
254
242
  * 위치 정확도를 설정해요.
@@ -298,7 +286,7 @@ declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEvent
298
286
  private isVisibilityChangedByTransparentServiceWebResult;
299
287
  }
300
288
 
301
- declare const appsInTossEvent: GraniteEvent<BackButtonClickHandleEvent | EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
289
+ declare const appsInTossEvent: GraniteEvent<EntryMessageExitedEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
302
290
 
303
291
  declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
304
292
  options: {
@@ -1423,16 +1411,16 @@ type GameCenterGameProfileResponse = {
1423
1411
  */
1424
1412
  declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
1425
1413
 
1426
- /**
1427
- * @public
1428
- * @category 인앱결제
1429
- * @name IapCreateOneTimePurchaseOrderOptions
1430
- * @description 인앱결제 1건을 요청할 때 필요한 정보예요.
1431
- * @property {string} productId - 주문할 상품의 ID예요.
1432
- */
1433
- interface IapCreateOneTimePurchaseOrderOptions {
1414
+ type Sku = {
1415
+ /**
1416
+ * @deprecated `productId`는 더 이상 사용하지 않아요. 대신 `sku`를 사용해요.
1417
+ */
1434
1418
  productId: string;
1435
- }
1419
+ sku?: string;
1420
+ } | {
1421
+ productId?: never;
1422
+ sku: string;
1423
+ };
1436
1424
  /**
1437
1425
  * @public
1438
1426
  * @category 인앱결제
@@ -1455,15 +1443,54 @@ interface IapCreateOneTimePurchaseOrderResult {
1455
1443
  fraction: number;
1456
1444
  miniAppIconUrl: string | null;
1457
1445
  }
1446
+ interface SuccessEvent {
1447
+ type: 'success';
1448
+ data: IapCreateOneTimePurchaseOrderResult;
1449
+ }
1450
+ interface PurchasedEvent {
1451
+ type: 'purchased';
1452
+ data: {
1453
+ orderId: string;
1454
+ };
1455
+ }
1458
1456
  /**
1459
1457
  * @public
1460
1458
  * @category 인앱결제
1461
- * @name iapCreateOneTimePurchaseOrder
1459
+ * @name IapCreateOneTimePurchaseOrderOptions
1460
+ * @property {Sku} options - 결제할 상품의 정보예요.
1461
+ * @property {string} options.sku - 주문할 상품의 고유 ID예요.
1462
+ * @property {(params: { orderId: string }) => boolean | Promise<boolean>} processProductGrant - 주문이 만들어진 뒤 실제로 상품을 지급할 때 호출해요. `orderId`를 받아서 지급 성공 여부를 `true` 또는 `Promise<true>`로 반환해요. 지급에 실패하면 `false`를 반환해요.
1463
+ * @property {(event: SuccessEvent) => void | Promise<void>} onEvent - 결제가 성공했을 때 호출해요. `event.type`이 `'success'`이고, `event.data`에 `IapCreateOneTimePurchaseOrderResult`가 들어 있어요.
1464
+ * @property {(error: unknown) => void | Promise<void>} onError - 결제 과정에서 에러가 발생했을 때 호출해요. 에러 객체를 받아서 로깅하거나 복구 절차를 실행할 수 있어요.
1465
+ */
1466
+ interface IapCreateOneTimePurchaseOrderOptions {
1467
+ options: Sku & {
1468
+ processProductGrant: (params: {
1469
+ orderId: string;
1470
+ }) => boolean | Promise<boolean>;
1471
+ };
1472
+ onEvent: (event: SuccessEvent) => void | Promise<void>;
1473
+ onError: (error: unknown) => void | Promise<void>;
1474
+ }
1475
+ interface IapRequestOneTimePurchaseOptions {
1476
+ options: Sku;
1477
+ onEvent: (event: PurchasedEvent | SuccessEvent) => void | Promise<void>;
1478
+ onError: (error: unknown) => void | Promise<void>;
1479
+ }
1480
+ declare function iapCreateOneTimePurchaseOrder(params: Sku): Promise<IapCreateOneTimePurchaseOrderResult>;
1481
+ declare function processProductGrant(params: {
1482
+ orderId: string;
1483
+ isProductGranted: boolean;
1484
+ }): Promise<void>;
1485
+ declare function requestOneTimePurchase(params: IapRequestOneTimePurchaseOptions): () => void;
1486
+ /**
1487
+ * @public
1488
+ * @category 인앱결제
1489
+ * @name createOneTimePurchaseOrder
1462
1490
  * @description
1463
1491
  * 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
1464
1492
  * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
1465
- * @param {string} params.productId - 주문할 상품의 ID예요.
1466
- * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
1493
+ * @returns {() => void} 앱브릿지 cleanup 함수를 반환해요. 인앱결제 기능이 끝나면 반드시 이 함수를 호출해서 리소스를 해제해야 해요.
1467
1494
  *
1468
1495
  * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
1469
1496
  * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
@@ -1475,41 +1502,53 @@ interface IapCreateOneTimePurchaseOrderResult {
1475
1502
  * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1476
1503
  * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
1477
1504
  * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
1505
+ * @throw {code: "PRODUCT_NOT_GRANTED_BY_PARTNER"} - 파트너사의 상품 지급이 실패했을 때 발생해요.
1478
1506
  *
1479
1507
  * @example
1480
1508
  * ### 특정 인앱결제 주문서 페이지로 이동하기
1481
1509
  *
1482
1510
  * ```tsx
1483
1511
  * import { IAP } from "@apps-in-toss/web-framework";
1484
- * import { Button } from "@toss-design-system/react-native";
1512
+ * import { Button } from "@toss/tds-react-native";
1513
+ * import { useCallback } from "react";
1485
1514
  *
1486
1515
  * interface Props {
1487
- * productId: string;
1516
+ * sku: string;
1488
1517
  * }
1489
1518
  *
1490
- * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1491
- * async function handleClick() {
1492
- * try {
1493
- * await IAP.createOneTimePurchaseOrder({
1494
- * productId,
1495
- * });
1496
- * console.error("인앱결제에 성공했어요");
1497
- * } catch (error) {
1498
- * console.error('인앱결제에 실패했어요:', error);
1499
- * }
1500
- * }
1519
+ * function IapCreateOneTimePurchaseOrderButton({ sku }: Props) {
1520
+ * const handleClick = useCallback(async () => {
1521
+ *
1522
+ * const cleanup = await IAP.createOneTimePurchaseOrder({
1523
+ * options: {
1524
+ * sku,
1525
+ * processProductGrant: ({ orderId }) => {
1526
+ * // 상품 지급 로직 작성
1527
+ * return true; // 상품 지급 여부
1528
+ * }
1529
+ * },
1530
+ * onEvent: (event) => {
1531
+ * console.log(event);
1532
+ * },
1533
+ * onError: (error) => {
1534
+ * console.error(error);
1535
+ * },
1536
+ * });
1537
+ *
1538
+ * return cleanup;
1539
+ * }, []);
1501
1540
  *
1502
1541
  * return <Button onClick={handleClick}>구매하기</Button>;
1503
1542
  * }
1504
1543
  * ```
1505
1544
  */
1506
- declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): Promise<IapCreateOneTimePurchaseOrderResult | undefined>;
1545
+ declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): () => void;
1507
1546
  /**
1508
1547
  * @public
1509
1548
  * @category 인앱결제
1510
1549
  * @name IapProductListItem
1511
1550
  * @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
1512
- * @property {string} sku - 상품의 고유 ID예요. [IAP.createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html)를 호출할때 사용하는 `productId`와 동일한 값이에요.
1551
+ * @property {string} sku - 상품의 고유 ID예요.
1513
1552
  * @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
1514
1553
  * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1515
1554
  * @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
@@ -1525,7 +1564,7 @@ interface IapProductListItem {
1525
1564
  /**
1526
1565
  * @public
1527
1566
  * @category 인앱결제
1528
- * @name iapGetProductItemList
1567
+ * @name getProductItemList
1529
1568
  * @description 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 상품 목록 화면에 진입할 때 호출해요.
1530
1569
  * @returns {Promise<{ products: IapProductListItem[] } | undefined>} 상품 목록을 포함한 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 `undefined`를 반환해요.
1531
1570
  *
@@ -1534,7 +1573,7 @@ interface IapProductListItem {
1534
1573
  *
1535
1574
  * ```tsx
1536
1575
  * import { IAP, IapProductListItem } from "@apps-in-toss/framework";
1537
- * import { Button, List, ListRow } from "@toss-design-system/react-native";
1576
+ * import { Button, List, ListRow } from "@toss/tds-react-native";
1538
1577
  * import { useEffect, useState } from "react";
1539
1578
  *
1540
1579
  * function IapProductList() {
@@ -1596,6 +1635,78 @@ interface IapProductListItem {
1596
1635
  declare function getProductItemList(): Promise<{
1597
1636
  products: IapProductListItem[];
1598
1637
  } | undefined>;
1638
+ /**
1639
+ * @public
1640
+ * @category 인앱결제
1641
+ * @name getPendingOrders
1642
+ * @description 대기 중인 주문 목록을 가져와요. 이 함수를 사용하면 결제가 아직 완료되지 않은 주문 정보를 확인할 수 있어요.
1643
+ * @returns {Promise<{orderIds: string[]}}>} 대기 중인 주문ID 배열을 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
1644
+ *
1645
+ * @example
1646
+ * ### 대기 중인 주문 목록 가져오기
1647
+ * ```typescript
1648
+ * import { IAP } from '@apps-in-toss/framework';
1649
+ *
1650
+ * async function fetchOrders() {
1651
+ * try {
1652
+ * const pendingOrders = await IAP.getPendingOrders();
1653
+ * return pendingOrders;
1654
+ * } catch (error) {
1655
+ * console.error(error);
1656
+ * }
1657
+ * }
1658
+ * ```
1659
+ */
1660
+ declare function getPendingOrders(): Promise<{
1661
+ orderIds: string[];
1662
+ } | undefined>;
1663
+ /**
1664
+ * @public
1665
+ * @category 인앱결제
1666
+ * @name CompletedOrRefundedOrdersResult
1667
+ * @description 인앱결제로 구매하거나 환불한 주문 목록을 나타내는 객체예요. 페이지네이션 정보를 포함해요.
1668
+ * @property {boolean} hasNext 다음 페이지가 있는지 여부예요. `true`면 더 많은 주문이 남아 있어요.
1669
+ * @property {string | null} [nextKey] 다음 주문 목록을 조회할 때 사용할 키예요. 마지막 페이지라면 `null`이거나 생략될 수 있어요.
1670
+ * @property {Array} orders 주문 정보를 담은 배열이에요. 각 요소는 하나의 주문을 나타내요.
1671
+ * @property {string} orders[].orderId 주문의 고유 ID예요.
1672
+ * @property {string} orders[].sku 주문 상품의 고유 ID예요.
1673
+ * @property {'COMPLETED' | 'REFUNDED'} orders[].status 주문의 상태예요. 'COMPLETED'는 주문이 완료된 상태, 'REFUNDED'는 환불된 상태를 의미해요.
1674
+ * @property {string} orders[].date 주문의 날짜 정보예요. ISO 8601 형식(YYYY-MM-DDTHH:mm:ss)을 사용해요. 예를 들어 "2025-09-22T00:00:00" 형식으로 제공돼요. 주문 상태가 `COMPLETED`라면 주문한 날짜를, `REFUNDED`라면 환불한 날짜를 나타내요.
1675
+ */
1676
+ interface CompletedOrRefundedOrdersResult {
1677
+ hasNext: boolean;
1678
+ nextKey?: string | null;
1679
+ orders: {
1680
+ orderId: string;
1681
+ sku: string;
1682
+ status: 'COMPLETED' | 'REFUNDED';
1683
+ date: string;
1684
+ }[];
1685
+ }
1686
+ /**
1687
+ * @public
1688
+ * @category 인앱결제
1689
+ * @name getCompletedOrRefundedOrders
1690
+ * @description 인앱결제로 구매하거나 환불한 주문 목록을 가져와요.
1691
+ * @returns {Promise<CompletedOrRefundedOrdersResult>} 페이지네이션을 포함한 주문 목록 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
1692
+ *
1693
+ * @example
1694
+ * ```typescript
1695
+ * import { IAP } from "@apps-in-toss/framework";
1696
+ *
1697
+ * async function fetchOrders() {
1698
+ * try {
1699
+ * const response = await IAP.getCompletedOrRefundedOrders();
1700
+ * return response;
1701
+ * } catch (error) {
1702
+ * console.error(error);
1703
+ * }
1704
+ * }
1705
+ * ```
1706
+ */
1707
+ declare function getCompletedOrRefundedOrders(params?: {
1708
+ key?: string | null;
1709
+ }): Promise<CompletedOrRefundedOrdersResult | undefined>;
1599
1710
  /**
1600
1711
  * @public
1601
1712
  * @category 인앱결제
@@ -1607,6 +1718,8 @@ declare function getProductItemList(): Promise<{
1607
1718
  declare const IAP: {
1608
1719
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
1609
1720
  getProductItemList: typeof getProductItemList;
1721
+ getPendingOrders: typeof getPendingOrders;
1722
+ getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
1610
1723
  };
1611
1724
 
1612
1725
  interface SaveBase64DataParams {
@@ -1773,10 +1886,30 @@ interface Spec extends TurboModule {
1773
1886
  }) => Promise<void>;
1774
1887
  saveBase64Data: (params: SaveBase64DataParams) => Promise<void>;
1775
1888
  /** IAP */
1776
- iapCreateOneTimePurchaseOrder: (params: IapCreateOneTimePurchaseOrderOptions) => Promise<IapCreateOneTimePurchaseOrderResult>;
1777
1889
  iapGetProductItemList: (arg: CompatiblePlaceholderArgument) => Promise<{
1778
1890
  products: IapProductListItem[];
1779
1891
  }>;
1892
+ /** @deprecated `requestOneTimePurchase`를 사용해주세요. */
1893
+ iapCreateOneTimePurchaseOrder: (params: {
1894
+ productId: string;
1895
+ }) => Promise<IapCreateOneTimePurchaseOrderResult>;
1896
+ requestOneTimePurchase: (params: {
1897
+ sku: string;
1898
+ }, fallbacks: {
1899
+ onPurchased: (params: {
1900
+ orderId: string;
1901
+ }) => void;
1902
+ }) => () => void;
1903
+ processProductGrant: (params: {
1904
+ orderId: string;
1905
+ isProductGranted: boolean;
1906
+ }) => Promise<void>;
1907
+ getPendingOrders: (params: CompatiblePlaceholderArgument) => Promise<{
1908
+ orderIds: string[];
1909
+ }>;
1910
+ getCompletedOrRefundedOrders: (params: {
1911
+ key?: string | null;
1912
+ }) => Promise<CompletedOrRefundedOrdersResult>;
1780
1913
  getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
1781
1914
  submitGameCenterLeaderBoardScore: (params: {
1782
1915
  score: string;
@@ -3195,4 +3328,4 @@ declare const INTERNAL__module: {
3195
3328
  tossCoreEventLog: typeof tossCoreEventLog;
3196
3329
  };
3197
3330
 
3198
- export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
3331
+ export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };