expo-iap 4.2.2 → 4.2.4

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.
Files changed (40) hide show
  1. package/build/index.d.ts +126 -33
  2. package/build/index.d.ts.map +1 -1
  3. package/build/index.js +123 -33
  4. package/build/index.js.map +1 -1
  5. package/build/kit-api.d.ts +54 -0
  6. package/build/kit-api.d.ts.map +1 -0
  7. package/build/kit-api.js +156 -0
  8. package/build/kit-api.js.map +1 -0
  9. package/build/modules/android.d.ts +22 -0
  10. package/build/modules/android.d.ts.map +1 -1
  11. package/build/modules/android.js +37 -0
  12. package/build/modules/android.js.map +1 -1
  13. package/build/modules/ios.d.ts +69 -1
  14. package/build/modules/ios.d.ts.map +1 -1
  15. package/build/modules/ios.js +73 -1
  16. package/build/modules/ios.js.map +1 -1
  17. package/build/types.d.ts +241 -75
  18. package/build/types.d.ts.map +1 -1
  19. package/build/types.js.map +1 -1
  20. package/build/useIAP.d.ts.map +1 -1
  21. package/build/useIAP.js +125 -3
  22. package/build/useIAP.js.map +1 -1
  23. package/build/useWebhookEvents.d.ts +26 -0
  24. package/build/useWebhookEvents.d.ts.map +1 -0
  25. package/build/useWebhookEvents.js +105 -0
  26. package/build/useWebhookEvents.js.map +1 -0
  27. package/build/webhook-client.d.ts +82 -0
  28. package/build/webhook-client.d.ts.map +1 -0
  29. package/build/webhook-client.js +176 -0
  30. package/build/webhook-client.js.map +1 -0
  31. package/openiap-versions.json +2 -2
  32. package/package.json +1 -1
  33. package/src/index.ts +141 -33
  34. package/src/kit-api.ts +229 -0
  35. package/src/modules/android.ts +47 -0
  36. package/src/modules/ios.ts +74 -1
  37. package/src/types.ts +247 -75
  38. package/src/useIAP.ts +125 -3
  39. package/src/useWebhookEvents.ts +155 -0
  40. package/src/webhook-client.ts +314 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;A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AAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,KAAK,EAC1D,UAAmD,EACC,EAAE;IACtD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,uCAAuC,CACxE,UAAU,CACX,CAAC;IACF,OAAO,MAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,uEAAuE","sourcesContent":["// External dependencies\n\n// Internal modules\n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport type {\n ExternalPurchaseCustomLinkNoticeResultIOS,\n ExternalPurchaseCustomLinkTokenResultIOS,\n ExternalPurchaseCustomLinkTokenTypeIOS,\n ExternalPurchaseCustomLinkNoticeTypeIOS,\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n VerifyPurchaseProps,\n VerifyPurchaseResultIOS,\n SubscriptionStatusIOS,\n} from '../types';\nimport type {PurchaseError} from '../utils/errorMapping';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId - The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupId) => {\n if (!groupId) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupId');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return (purchases ?? []) as PurchaseIOS[];\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n return ExpoIapModule.getReceiptDataIOS();\n};\n\nexport const getReceiptIOS = getReceiptDataIOS;\n\n/**\n * Refresh the receipt data from Apple's servers and return the updated receipt.\n * This calls AppStore.sync() before reading the receipt, ensuring the latest\n * receipt data is available. Use this after a first purchase when\n * getReceiptDataIOS() may return an empty string because the receipt file\n * has not yet been written to disk.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @platform iOS\n */\nexport const requestReceiptRefreshIOS = async (): Promise<string> => {\n return ExpoIapModule.requestReceiptRefreshIOS();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @deprecated Use verifyPurchase instead\n * @param props The product's SKU or verification props\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n */\nconst validateReceiptIOSImpl = async (props: VerifyPurchaseProps | string) => {\n const sku =\n typeof props === 'string'\n ? props\n : (props as VerifyPurchaseProps)?.apple?.sku;\n\n if (!sku) {\n throw new Error('validateReceiptIOS requires a SKU (via apple.sku)');\n }\n\n return (await ExpoIapModule.validateReceiptIOS(\n sku,\n )) as VerifyPurchaseResultIOS;\n};\n\nexport const validateReceiptIOS =\n validateReceiptIOSImpl as QueryField<'validateReceiptIOS'>;\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @deprecated Use promotedProductListenerIOS to receive the productId,\n * then call requestPurchase with that SKU instead.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n */\nexport const requestPurchaseOnPromotedProductIOS =\n async (): Promise<boolean> => {\n const result = await ExpoIapModule.requestPurchaseOnPromotedProductIOS();\n return result ?? true;\n };\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\nexport const getAllTransactionsIOS: QueryField<\n 'getAllTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getAllTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 18.2+).\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 15.4+).\n * This must be called before opening an external purchase link.\n * Returns the external purchase token when user continues.\n *\n * @returns Promise resolving to the result with action, token, and error if any\n * @platform iOS\n */\nexport const presentExternalPurchaseNoticeSheetIOS =\n async (): Promise<ExternalPurchaseNoticeResultIOS> => {\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n };\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n/**\n * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).\n * Returns true if the app can use custom external purchase links.\n *\n * @returns Promise resolving to true if eligible\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible\n */\nexport const isEligibleForExternalPurchaseCustomLinkIOS =\n async (): Promise<boolean> => {\n return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());\n };\n\n/**\n * Get external purchase token for reporting to Apple (iOS 18.1+).\n * Use this token with Apple's External Purchase Server API to report transactions.\n *\n * @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)\n * @returns Promise resolving to the token result with token string or error\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)\n */\nexport const getExternalPurchaseCustomLinkTokenIOS = async (\n tokenType: ExternalPurchaseCustomLinkTokenTypeIOS,\n): Promise<ExternalPurchaseCustomLinkTokenResultIOS> => {\n if (!tokenType) {\n throw new Error(\n \"getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')\",\n );\n }\n const result = await ExpoIapModule.getExternalPurchaseCustomLinkTokenIOS(\n tokenType,\n );\n return result as ExternalPurchaseCustomLinkTokenResultIOS;\n};\n\n/**\n * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).\n * Displays the system disclosure notice sheet for custom external purchase links.\n * Call this after a deliberate customer interaction before linking out to external purchases.\n *\n * @param noticeType - Notice type: 'browser' (external purchases displayed in browser)\n * @returns Promise resolving to the result with continued status and error if any\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)\n */\nexport const showExternalPurchaseCustomLinkNoticeIOS = async (\n noticeType: ExternalPurchaseCustomLinkNoticeTypeIOS,\n): Promise<ExternalPurchaseCustomLinkNoticeResultIOS> => {\n if (!noticeType) {\n throw new Error(\n \"showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')\",\n );\n }\n const result = await ExpoIapModule.showExternalPurchaseCustomLinkNoticeIOS(\n noticeType,\n );\n return result as ExternalPurchaseCustomLinkNoticeResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
1
+ {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AA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AiD,EACE,EAAE;IACrD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,qCAAqC,CACtE,SAAS,CACV,CAAC;IACF,OAAO,MAAkD,CAAC;AAC5D,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,KAAK,EAC1D,UAAmD,EACC,EAAE;IACtD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,uCAAuC,CACxE,UAAU,CACX,CAAC;IACF,OAAO,MAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,uEAAuE","sourcesContent":["// External dependencies\n\n// Internal modules\n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport type {\n ExternalPurchaseCustomLinkNoticeResultIOS,\n ExternalPurchaseCustomLinkTokenResultIOS,\n ExternalPurchaseCustomLinkTokenTypeIOS,\n ExternalPurchaseCustomLinkNoticeTypeIOS,\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n VerifyPurchaseProps,\n VerifyPurchaseResultIOS,\n SubscriptionStatusIOS,\n} from '../types';\nimport type {PurchaseError} from '../utils/errorMapping';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/sync-ios}\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId - The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios}\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupId) => {\n if (!groupId) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupId');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/subscription-status-ios}\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/current-entitlement-ios}\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/latest-transaction-ios}\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/begin-refund-request-ios}\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/show-manage-subscriptions-ios}\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return (purchases ?? []) as PurchaseIOS[];\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-receipt-data-ios}\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n return ExpoIapModule.getReceiptDataIOS();\n};\n\nexport const getReceiptIOS = getReceiptDataIOS;\n\n/**\n * Get the current App Store storefront country code on iOS.\n *\n * @deprecated Use cross-platform `getStorefront` from the main index instead.\n * The native module exposes a single `getStorefront` AsyncFunction that already\n * resolves to the iOS storefront on iOS. This helper is kept as an iOS-only\n * alias so consumers who previously imported `getStorefrontIOS` do not break.\n *\n * @returns {Promise<string>} ISO 3166-1 alpha-2 country code (e.g. \"US\")\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-storefront-ios}\n */\nexport const getStorefrontIOS: QueryField<'getStorefrontIOS'> = async () => {\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * Refresh the receipt data from Apple's servers and return the updated receipt.\n * This calls AppStore.sync() before reading the receipt, ensuring the latest\n * receipt data is available. Use this after a first purchase when\n * getReceiptDataIOS() may return an empty string because the receipt file\n * has not yet been written to disk.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @platform iOS\n */\nexport const requestReceiptRefreshIOS = async (): Promise<string> => {\n return ExpoIapModule.requestReceiptRefreshIOS();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/is-transaction-verified-ios}\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-transaction-jws-ios}\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @deprecated Use verifyPurchase instead\n * @param props The product's SKU or verification props\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/validate-receipt-ios}\n */\nconst validateReceiptIOSImpl = async (props: VerifyPurchaseProps | string) => {\n const sku =\n typeof props === 'string'\n ? props\n : (props as VerifyPurchaseProps)?.apple?.sku;\n\n if (!sku) {\n throw new Error('validateReceiptIOS requires a SKU (via apple.sku)');\n }\n\n return (await ExpoIapModule.validateReceiptIOS(\n sku,\n )) as VerifyPurchaseResultIOS;\n};\n\nexport const validateReceiptIOS =\n validateReceiptIOSImpl as QueryField<'validateReceiptIOS'>;\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-app-transaction-ios}\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-promoted-product-ios}\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @deprecated Use promotedProductListenerIOS to receive the productId,\n * then call requestPurchase with that SKU instead.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}\n */\nexport const requestPurchaseOnPromotedProductIOS =\n async (): Promise<boolean> => {\n const result = await ExpoIapModule.requestPurchaseOnPromotedProductIOS();\n return result ?? true;\n };\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-pending-transactions-ios}\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * List every StoreKit transaction (finished + unfinished) for the current user.\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-all-transactions-ios}\n */\nexport const getAllTransactionsIOS: QueryField<\n 'getAllTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getAllTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/clear-transaction-ios}\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 17.4+).\n *\n * Wraps `ExternalPurchase.canPresent`, which Apple introduced in iOS 17.4.\n * Note: the notice sheet itself (`presentExternalPurchaseNoticeSheetIOS`)\n * still requires iOS 18.2+; only the eligibility check is available earlier.\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios}\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 15.4+).\n * This must be called before opening an external purchase link.\n * Returns the external purchase token when user continues.\n *\n * @returns Promise resolving to the result with action, token, and error if any\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios}\n */\nexport const presentExternalPurchaseNoticeSheetIOS =\n async (): Promise<ExternalPurchaseNoticeResultIOS> => {\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n };\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/present-external-purchase-link-ios}\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n/**\n * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).\n * Returns true if the app can use custom external purchase links.\n *\n * @returns Promise resolving to true if eligible\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios}\n */\nexport const isEligibleForExternalPurchaseCustomLinkIOS =\n async (): Promise<boolean> => {\n return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());\n };\n\n/**\n * Get external purchase token for reporting to Apple (iOS 18.1+).\n * Use this token with Apple's External Purchase Server API to report transactions.\n *\n * @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)\n * @returns Promise resolving to the token result with token string or error\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios}\n */\nexport const getExternalPurchaseCustomLinkTokenIOS = async (\n tokenType: ExternalPurchaseCustomLinkTokenTypeIOS,\n): Promise<ExternalPurchaseCustomLinkTokenResultIOS> => {\n if (!tokenType) {\n throw new Error(\n \"getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')\",\n );\n }\n const result = await ExpoIapModule.getExternalPurchaseCustomLinkTokenIOS(\n tokenType,\n );\n return result as ExternalPurchaseCustomLinkTokenResultIOS;\n};\n\n/**\n * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).\n * Displays the system disclosure notice sheet for custom external purchase links.\n * Call this after a deliberate customer interaction before linking out to external purchases.\n *\n * @param noticeType - Notice type: 'browser' (external purchases displayed in browser)\n * @returns Promise resolving to the result with continued status and error if any\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)\n *\n * @see {@link https://www.openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios}\n */\nexport const showExternalPurchaseCustomLinkNoticeIOS = async (\n noticeType: ExternalPurchaseCustomLinkNoticeTypeIOS,\n): Promise<ExternalPurchaseCustomLinkNoticeResultIOS> => {\n if (!noticeType) {\n throw new Error(\n \"showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')\",\n );\n }\n const result = await ExpoIapModule.showExternalPurchaseCustomLinkNoticeIOS(\n noticeType,\n );\n return result as ExternalPurchaseCustomLinkNoticeResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
package/build/types.d.ts CHANGED
@@ -535,118 +535,176 @@ export interface LimitedQuantityInfoAndroid {
535
535
  remainingQuantity: number;
536
536
  }
537
537
  export interface Mutation {
538
- /** Acknowledge a non-consumable purchase or subscription */
538
+ /**
539
+ * Acknowledge a non-consumable purchase. Required within 3 days or Google auto-refunds.
540
+ * See: https://www.openiap.dev/docs/apis/android/acknowledge-purchase-android
541
+ */
539
542
  acknowledgePurchaseAndroid: Promise<boolean>;
540
- /** Initiate a refund request for a product (iOS 15+) */
543
+ /**
544
+ * Present the refund request sheet (iOS 15+). See also Features → Refund.
545
+ * See: https://www.openiap.dev/docs/apis/ios/begin-refund-request-ios
546
+ */
541
547
  beginRefundRequestIOS?: Promise<(string | null)>;
542
548
  /**
543
- * Check if alternative billing is available for this user/device
544
- * Step 1 of alternative billing flow
549
+ * Check whether alternative billing is available for the user. Step 1 of the alternative billing flow.
545
550
  *
546
- * Returns true if available, false otherwise
547
- * Throws OpenIapError.NotPrepared if billing client not ready
551
+ * Returns true if available, false otherwise.
552
+ * Throws OpenIapError.NotPrepared if billing client not ready.
553
+ * See: https://www.openiap.dev/docs/apis/android/check-alternative-billing-availability-android
548
554
  */
549
555
  checkAlternativeBillingAvailabilityAndroid: Promise<boolean>;
550
- /** Clear pending transactions from the StoreKit payment queue */
556
+ /**
557
+ * Clear pending transactions in the queue (sandbox helper).
558
+ * See: https://www.openiap.dev/docs/apis/ios/clear-transaction-ios
559
+ */
551
560
  clearTransactionIOS: Promise<boolean>;
552
- /** Consume a purchase token so it can be repurchased */
561
+ /**
562
+ * Consume a consumable purchase so it can be re-bought.
563
+ * See: https://www.openiap.dev/docs/apis/android/consume-purchase-android
564
+ */
553
565
  consumePurchaseAndroid: Promise<boolean>;
554
566
  /**
555
- * Create external transaction token for Google Play reporting
556
- * Step 3 of alternative billing flow
557
- * Must be called AFTER successful payment in your payment system
558
- * Token must be reported to Google Play backend within 24 hours
567
+ * Create a reporting token for an alternative billing flow. Step 3 of the alternative billing flow.
568
+ * Must be called AFTER successful payment in your payment system.
569
+ * Token must be reported to Google Play backend within 24 hours.
559
570
  *
560
- * Returns token string, or null if creation failed
561
- * Throws OpenIapError.NotPrepared if billing client not ready
571
+ * Returns token string, or null if creation failed.
572
+ * Throws OpenIapError.NotPrepared if billing client not ready.
573
+ * See: https://www.openiap.dev/docs/apis/android/create-alternative-billing-token-android
562
574
  */
563
575
  createAlternativeBillingTokenAndroid?: Promise<(string | null)>;
564
576
  /**
565
- * Create reporting details for a billing program
566
- * Replaces the deprecated createExternalOfferReportingDetailsAsync API
577
+ * Create the reporting payload Google requires after a Developer-Provided Billing transaction (Play Billing 8.3.0+).
578
+ * Replaces the deprecated createExternalOfferReportingDetailsAsync API.
567
579
  *
568
- * Available in Google Play Billing Library 8.2.0+
569
- * Returns external transaction token needed for reporting external transactions
570
- * Throws OpenIapError.NotPrepared if billing client not ready
580
+ * Returns external transaction token needed for reporting external transactions.
581
+ * Throws OpenIapError.NotPrepared if billing client not ready.
582
+ * See: https://www.openiap.dev/docs/apis/android/create-billing-program-reporting-details-android
571
583
  */
572
584
  createBillingProgramReportingDetailsAndroid: Promise<BillingProgramReportingDetailsAndroid>;
573
- /** Open the native subscription management surface */
585
+ /**
586
+ * Open the platform's subscription management UI.
587
+ * See: https://www.openiap.dev/docs/apis/deep-link-to-subscriptions
588
+ */
574
589
  deepLinkToSubscriptions: Promise<void>;
575
- /** Close the platform billing connection */
590
+ /**
591
+ * Close the store connection and release resources.
592
+ * See: https://www.openiap.dev/docs/apis/end-connection
593
+ */
576
594
  endConnection: Promise<boolean>;
577
- /** Finish a transaction after validating receipts */
595
+ /**
596
+ * Complete a transaction after server-side verification. Required on Android within 3 days.
597
+ * See: https://www.openiap.dev/docs/apis/finish-transaction
598
+ */
578
599
  finishTransaction: Promise<void>;
579
- /** Establish the platform billing connection */
600
+ /**
601
+ * Initialize the store connection. Call before any IAP API.
602
+ * See: https://www.openiap.dev/docs/apis/init-connection
603
+ */
580
604
  initConnection: Promise<boolean>;
581
605
  /**
582
- * Check if a billing program is available for the current user
583
- * Replaces the deprecated isExternalOfferAvailableAsync API
606
+ * Check whether a billing program (e.g., External Payments) is available for the current user.
607
+ * Replaces the deprecated isExternalOfferAvailableAsync API.
584
608
  *
585
- * Available in Google Play Billing Library 8.2.0+
586
- * Returns availability result with isAvailable flag
587
- * Throws OpenIapError.NotPrepared if billing client not ready
609
+ * Available in Google Play Billing Library 8.2.0+.
610
+ * Returns availability result with isAvailable flag.
611
+ * Throws OpenIapError.NotPrepared if billing client not ready.
612
+ * See: https://www.openiap.dev/docs/apis/android/is-billing-program-available-android
588
613
  */
589
614
  isBillingProgramAvailableAndroid: Promise<BillingProgramAvailabilityResultAndroid>;
590
615
  /**
591
- * Launch external link flow for external billing programs
592
- * Replaces the deprecated showExternalOfferInformationDialog API
616
+ * Launch an external content/offer link from inside the Billing Programs flow (Play Billing 8.2.0+).
617
+ * Replaces the deprecated showExternalOfferInformationDialog API.
593
618
  *
594
- * Available in Google Play Billing Library 8.2.0+
595
- * Shows Play Store dialog and optionally launches external URL
596
- * Throws OpenIapError.NotPrepared if billing client not ready
619
+ * Shows Play Store dialog and optionally launches external URL.
620
+ * Throws OpenIapError.NotPrepared if billing client not ready.
621
+ * See: https://www.openiap.dev/docs/apis/android/launch-external-link-android
597
622
  */
598
623
  launchExternalLinkAndroid: Promise<boolean>;
599
- /** Present the App Store code redemption sheet */
624
+ /**
625
+ * Show the App Store offer code redemption sheet.
626
+ * See: https://www.openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios
627
+ */
600
628
  presentCodeRedemptionSheetIOS: Promise<boolean>;
601
- /** Present external purchase custom link with StoreKit UI */
629
+ /**
630
+ * Present an external purchase link, StoreKit External (iOS 16+).
631
+ * See: https://www.openiap.dev/docs/apis/ios/present-external-purchase-link-ios
632
+ */
602
633
  presentExternalPurchaseLinkIOS: Promise<ExternalPurchaseLinkResultIOS>;
603
634
  /**
604
- * Present external purchase notice sheet (iOS 17.4+).
605
- * Uses ExternalPurchase.presentNoticeSheet() which returns a token when user continues.
635
+ * Present the external purchase notice sheet (iOS 17.4+).
636
+ * Uses ExternalPurchase.presentNoticeSheet() which returns a token when the user continues.
606
637
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchase/presentnoticesheet()
638
+ * See: https://www.openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios
607
639
  */
608
640
  presentExternalPurchaseNoticeSheetIOS: Promise<ExternalPurchaseNoticeResultIOS>;
609
- /** Initiate a purchase flow; rely on events for final state */
641
+ /**
642
+ * Initiate a purchase or subscription flow; rely on events for final state.
643
+ * See: https://www.openiap.dev/docs/apis/request-purchase
644
+ */
610
645
  requestPurchase?: Promise<(Purchase | Purchase[] | null)>;
611
646
  /**
612
- * Purchase the promoted product surfaced by the App Store.
647
+ * Buy the currently promoted product.
613
648
  *
614
649
  * @deprecated Use promotedProductListenerIOS to receive the productId,
615
650
  * then call requestPurchase with that SKU instead. In StoreKit 2,
616
651
  * promoted products can be purchased directly via the standard purchase flow.
652
+ * See: https://www.openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios
617
653
  * @deprecated Use promotedProductListenerIOS + requestPurchase instead
618
654
  */
619
655
  requestPurchaseOnPromotedProductIOS: Promise<boolean>;
620
- /** Restore completed purchases across platforms */
656
+ /**
657
+ * Restore non-consumable and active subscription purchases.
658
+ * See: https://www.openiap.dev/docs/apis/restore-purchases
659
+ */
621
660
  restorePurchases: Promise<void>;
622
661
  /**
623
- * Show alternative billing information dialog to user
624
- * Step 2 of alternative billing flow
625
- * Must be called BEFORE processing payment in your payment system
662
+ * Display Google's alternative billing information dialog. Step 2 of the alternative billing flow.
663
+ * Must be called BEFORE processing payment in your payment system.
626
664
  *
627
- * Returns true if user accepted, false if user canceled
628
- * Throws OpenIapError.NotPrepared if billing client not ready
665
+ * Returns true if user accepted, false if user canceled.
666
+ * Throws OpenIapError.NotPrepared if billing client not ready.
667
+ * See: https://www.openiap.dev/docs/apis/android/show-alternative-billing-dialog-android
629
668
  */
630
669
  showAlternativeBillingDialogAndroid: Promise<boolean>;
631
670
  /**
632
- * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).
633
- * Displays the system disclosure notice sheet for custom external purchase links.
671
+ * Present the disclosure sheet required before linking out via ExternalPurchaseCustomLink (iOS 18.1+).
634
672
  * Call this after a deliberate customer interaction before linking out to external purchases.
635
673
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)
674
+ * See: https://www.openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios
636
675
  */
637
676
  showExternalPurchaseCustomLinkNoticeIOS: Promise<ExternalPurchaseCustomLinkNoticeResultIOS>;
638
- /** Open subscription management UI and return changed purchases (iOS 15+) */
677
+ /**
678
+ * Present the manage-subscriptions sheet and return changed purchases (iOS 15+).
679
+ * See: https://www.openiap.dev/docs/apis/ios/show-manage-subscriptions-ios
680
+ */
639
681
  showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;
640
- /** Force a StoreKit sync for transactions (iOS 15+) */
682
+ /**
683
+ * Force sync transactions with the App Store (iOS 15+).
684
+ * See: https://www.openiap.dev/docs/apis/ios/sync-ios
685
+ */
641
686
  syncIOS: Promise<boolean>;
642
687
  /**
643
- * Validate purchase receipts with the configured providers
688
+ * Deprecated. Validate purchase receipts with the configured providers — use verifyPurchase instead.
689
+ * See: https://www.openiap.dev/docs/features/validation#verify-purchase
644
690
  * @deprecated Use verifyPurchase
645
691
  */
646
692
  validateReceipt: Promise<VerifyPurchaseResult>;
647
- /** Verify purchases with the configured providers */
693
+ /**
694
+ * Verify a purchase against your own backend. Returns a platform-specific
695
+ * variant of VerifyPurchaseResult — VerifyPurchaseResultIOS exposes isValid
696
+ * + receipt/JWS metadata, VerifyPurchaseResultAndroid carries Play Store
697
+ * receipt fields (no isValid), and VerifyPurchaseResultHorizon uses success.
698
+ * Inspect the concrete variant before reading fields.
699
+ * See: https://www.openiap.dev/docs/features/validation#verify-purchase
700
+ */
648
701
  verifyPurchase: Promise<VerifyPurchaseResult>;
649
- /** Verify purchases with a specific provider (e.g., IAPKit) */
702
+ /**
703
+ * Verify via a managed provider without standing up your own server. The
704
+ * PurchaseVerificationProvider enum currently exposes only IAPKit; platform
705
+ * availability may differ by implementation.
706
+ * See: https://www.openiap.dev/docs/features/validation#verify-purchase-with-provider
707
+ */
650
708
  verifyPurchaseWithProvider: Promise<VerifyPurchaseWithProviderResult>;
651
709
  }
652
710
  export type MutationAcknowledgePurchaseAndroidArgs = string;
@@ -1130,66 +1188,117 @@ export type PurchaseState = 'pending' | 'purchased' | 'unknown';
1130
1188
  export type PurchaseVerificationProvider = 'iapkit';
1131
1189
  export interface Query {
1132
1190
  /**
1133
- * Check if external purchase notice sheet can be presented (iOS 17.4+)
1134
- * Uses ExternalPurchase.canPresent
1191
+ * Check eligibility for the external purchase notice sheet (iOS 17.4+).
1192
+ * Uses ExternalPurchase.canPresent.
1193
+ * See: https://www.openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios
1135
1194
  */
1136
1195
  canPresentExternalPurchaseNoticeIOS: Promise<boolean>;
1137
- /** Get current StoreKit 2 entitlements (iOS 15+) */
1196
+ /**
1197
+ * Get the user's current entitlement for a product, using StoreKit 2 (iOS 15+).
1198
+ * See: https://www.openiap.dev/docs/apis/ios/current-entitlement-ios
1199
+ */
1138
1200
  currentEntitlementIOS?: Promise<(PurchaseIOS | null)>;
1139
- /** Retrieve products or subscriptions from the store */
1201
+ /**
1202
+ * Fetch products or subscriptions from the store.
1203
+ * See: https://www.openiap.dev/docs/apis/fetch-products
1204
+ */
1140
1205
  fetchProducts: Promise<(ProductOrSubscription[] | Product[] | ProductSubscription[] | null)>;
1141
- /** Get active subscriptions (filters by subscriptionIds when provided) */
1206
+ /**
1207
+ * Get details of all currently active subscriptions (filters by subscriptionIds when provided).
1208
+ * See: https://www.openiap.dev/docs/apis/get-active-subscriptions
1209
+ */
1142
1210
  getActiveSubscriptions: Promise<ActiveSubscription[]>;
1143
1211
  /**
1144
- * Get the full StoreKit 2 transaction history as PurchaseIOS values.
1212
+ * List every StoreKit transaction (finished + unfinished) for the current user.
1145
1213
  * Requires the SK2ConsumableTransactionHistory Info.plist key in the host app
1146
1214
  * for finished consumables to be included (iOS 18+).
1147
1215
  * Unlike getAvailablePurchases, always returns the iOS-specific PurchaseIOS shape.
1216
+ * See: https://www.openiap.dev/docs/apis/ios/get-all-transactions-ios
1148
1217
  */
1149
1218
  getAllTransactionsIOS: Promise<PurchaseIOS[]>;
1150
- /** Fetch the current app transaction (iOS 16+) */
1219
+ /**
1220
+ * Fetch the app transaction (iOS 16+).
1221
+ * See: https://www.openiap.dev/docs/apis/ios/get-app-transaction-ios
1222
+ */
1151
1223
  getAppTransactionIOS?: Promise<(AppTransaction | null)>;
1152
- /** Get all available purchases for the current user */
1224
+ /**
1225
+ * List active purchases for the current user.
1226
+ * See: https://www.openiap.dev/docs/apis/get-available-purchases
1227
+ */
1153
1228
  getAvailablePurchases: Promise<Purchase[]>;
1154
1229
  /**
1155
- * Get external purchase token for reporting to Apple (iOS 18.1+).
1156
- * Use this token with Apple's External Purchase Server API to report transactions.
1230
+ * Fetch a token for Apple's External Purchase Server reporting API (iOS 18.1+).
1231
+ * Use this token to report transactions made through ExternalPurchaseCustomLink.
1157
1232
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
1233
+ * See: https://www.openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios
1158
1234
  */
1159
1235
  getExternalPurchaseCustomLinkTokenIOS: Promise<ExternalPurchaseCustomLinkTokenResultIOS>;
1160
- /** Retrieve all pending transactions in the StoreKit queue */
1236
+ /**
1237
+ * List unfinished StoreKit transactions in the queue.
1238
+ * See: https://www.openiap.dev/docs/apis/ios/get-pending-transactions-ios
1239
+ */
1161
1240
  getPendingTransactionsIOS: Promise<PurchaseIOS[]>;
1162
- /** Get the currently promoted product (iOS 11+) */
1241
+ /**
1242
+ * Read the App Store-promoted product, if any (iOS 11+).
1243
+ * See: https://www.openiap.dev/docs/apis/ios/get-promoted-product-ios
1244
+ */
1163
1245
  getPromotedProductIOS?: Promise<(ProductIOS | null)>;
1164
- /** Get base64-encoded receipt data for validation */
1246
+ /**
1247
+ * Get base64-encoded receipt data (legacy validation).
1248
+ * See: https://www.openiap.dev/docs/apis/ios/get-receipt-data-ios
1249
+ */
1165
1250
  getReceiptDataIOS?: Promise<(string | null)>;
1166
- /** Get the current storefront country code */
1251
+ /**
1252
+ * Return the user's storefront country code.
1253
+ * See: https://www.openiap.dev/docs/apis/get-storefront
1254
+ */
1167
1255
  getStorefront: Promise<string>;
1168
1256
  /**
1169
- * Get the current App Store storefront country code
1257
+ * Deprecated. Get the current App Store storefront country code — use cross-platform getStorefront instead.
1258
+ * See: https://www.openiap.dev/docs/apis/ios/get-storefront-ios
1170
1259
  * @deprecated Use getStorefront
1171
1260
  */
1172
1261
  getStorefrontIOS: Promise<string>;
1173
- /** Get the transaction JWS (StoreKit 2) */
1262
+ /**
1263
+ * Return the JWS string for a transaction (StoreKit 2).
1264
+ * See: https://www.openiap.dev/docs/apis/ios/get-transaction-jws-ios
1265
+ */
1174
1266
  getTransactionJwsIOS?: Promise<(string | null)>;
1175
- /** Check whether the user has active subscriptions */
1267
+ /**
1268
+ * Check whether the user has any active subscription.
1269
+ * See: https://www.openiap.dev/docs/apis/has-active-subscriptions
1270
+ */
1176
1271
  hasActiveSubscriptions: Promise<boolean>;
1177
1272
  /**
1178
- * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).
1273
+ * Check eligibility for the custom-link variant of external purchase (iOS 18.1+).
1179
1274
  * Returns true if the app can use custom external purchase links.
1180
1275
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible
1276
+ * See: https://www.openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios
1181
1277
  */
1182
1278
  isEligibleForExternalPurchaseCustomLinkIOS: Promise<boolean>;
1183
- /** Check introductory offer eligibility for a subscription group */
1279
+ /**
1280
+ * Check intro-offer eligibility for a subscription group.
1281
+ * See: https://www.openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios
1282
+ */
1184
1283
  isEligibleForIntroOfferIOS: Promise<boolean>;
1185
- /** Verify a StoreKit 2 transaction signature */
1284
+ /**
1285
+ * Check whether a transaction's JWS verification passed (StoreKit 2).
1286
+ * See: https://www.openiap.dev/docs/apis/ios/is-transaction-verified-ios
1287
+ */
1186
1288
  isTransactionVerifiedIOS: Promise<boolean>;
1187
- /** Get the latest transaction for a product using StoreKit 2 */
1289
+ /**
1290
+ * Get the latest verified transaction for a product, using StoreKit 2.
1291
+ * See: https://www.openiap.dev/docs/apis/ios/latest-transaction-ios
1292
+ */
1188
1293
  latestTransactionIOS?: Promise<(PurchaseIOS | null)>;
1189
- /** Get StoreKit 2 subscription status details (iOS 15+) */
1294
+ /**
1295
+ * Get subscription status objects from StoreKit 2 (iOS 15+).
1296
+ * See: https://www.openiap.dev/docs/apis/ios/subscription-status-ios
1297
+ */
1190
1298
  subscriptionStatusIOS: Promise<SubscriptionStatusIOS[]>;
1191
1299
  /**
1192
- * Validate a receipt for a specific product
1300
+ * Deprecated. Legacy App Store receipt validation use verifyPurchase instead.
1301
+ * See: https://www.openiap.dev/docs/apis/ios/validate-receipt-ios
1193
1302
  * @deprecated Use verifyPurchase
1194
1303
  */
1195
1304
  validateReceiptIOS: Promise<VerifyPurchaseResultIOS>;
@@ -1638,6 +1747,7 @@ export interface SubscriptionProductReplacementParamsAndroid {
1638
1747
  * Available in Google Play Billing Library 8.1.0+
1639
1748
  */
1640
1749
  export type SubscriptionReplacementModeAndroid = 'unknown-replacement-mode' | 'with-time-proration' | 'charge-prorated-price' | 'charge-full-price' | 'without-proration' | 'deferred' | 'keep-existing';
1750
+ export type SubscriptionState = 'active' | 'expired' | 'in-billing-retry' | 'in-grace-period' | 'paused' | 'refunded' | 'revoked' | 'unknown';
1641
1751
  export interface SubscriptionStatusIOS {
1642
1752
  renewalInfo?: (RenewalInfoIOS | null);
1643
1753
  state: string;
@@ -1784,6 +1894,62 @@ export interface VerifyPurchaseWithProviderResult {
1784
1894
  provider: PurchaseVerificationProvider;
1785
1895
  }
1786
1896
  export type VoidResult = void;
1897
+ export type WebhookCancellationReason = 'billing-error' | 'other' | 'price-increase-declined' | 'product-unavailable' | 'refunded' | 'user-canceled';
1898
+ export interface WebhookEvent {
1899
+ /** Reason for cancellation, when applicable. */
1900
+ cancellationReason?: (WebhookCancellationReason | null);
1901
+ /** Localized currency code (ISO 4217) at event time, when available. */
1902
+ currency?: (string | null);
1903
+ environment: WebhookEventEnvironment;
1904
+ /** When the current subscription period ends. Epoch milliseconds. */
1905
+ expiresAt?: (number | null);
1906
+ /**
1907
+ * Stable identifier suitable for idempotency. Derived from the source notification
1908
+ * UUID where the store provides one (ASN v2 `notificationUUID`, RTDN message id);
1909
+ * otherwise hashed from the canonicalized payload.
1910
+ */
1911
+ id: string;
1912
+ /** Time the underlying event occurred at the store. Epoch milliseconds. */
1913
+ occurredAt: number;
1914
+ platform: IapPlatform;
1915
+ /**
1916
+ * Price in micros (1/1,000,000 of the currency unit) at event time, when available.
1917
+ * Matches Google Play's `priceAmountMicros` convention; iOS values are converted.
1918
+ */
1919
+ priceAmountMicros?: (number | null);
1920
+ /** Product the event pertains to. May be null for account-level events. */
1921
+ productId?: (string | null);
1922
+ /** kit project that owns the subscription / purchase this event refers to. */
1923
+ projectId: string;
1924
+ /**
1925
+ * Cross-platform purchase identity used to correlate this event with an existing
1926
+ * purchase record. iOS: `originalTransactionId`. Android: `purchaseToken`.
1927
+ * Null for `TestNotification` events (Apple ASN v2 / Google RTDN test
1928
+ * payloads carry no transaction); always present for every other event type.
1929
+ */
1930
+ purchaseToken?: (string | null);
1931
+ /**
1932
+ * Original signed payload from the store. ASN v2 events expose the JWS string;
1933
+ * RTDN events expose the base64-decoded Pub/Sub message JSON. Provided so that
1934
+ * consumers can independently verify or extract platform-specific fields. kit
1935
+ * always validates this payload before emitting the event.
1936
+ */
1937
+ rawSignedPayload?: (string | null);
1938
+ /** Time kit ingested and normalized this event. Epoch milliseconds. */
1939
+ receivedAt: number;
1940
+ /** When auto-renewal will charge again. Epoch milliseconds. */
1941
+ renewsAt?: (number | null);
1942
+ source: WebhookEventSource;
1943
+ /**
1944
+ * Normalized subscription state at the time of event, when the event refers to
1945
+ * a subscription. Null for one-time purchase events.
1946
+ */
1947
+ subscriptionState?: (SubscriptionState | null);
1948
+ type: WebhookEventType;
1949
+ }
1950
+ export type WebhookEventEnvironment = 'production' | 'sandbox' | 'xcode';
1951
+ export type WebhookEventSource = 'apple-app-store-server-notifications-v2' | 'google-play-real-time-developer-notifications' | 'meta-horizon-reconciler';
1952
+ export type WebhookEventType = 'purchase-consumption-request' | 'purchase-refunded' | 'subscription-canceled' | 'subscription-expired' | 'subscription-in-billing-retry' | 'subscription-in-grace-period' | 'subscription-paused' | 'subscription-price-change' | 'subscription-product-changed' | 'subscription-recovered' | 'subscription-renewed' | 'subscription-resumed' | 'subscription-revoked' | 'subscription-started' | 'subscription-uncanceled' | 'test-notification';
1787
1953
  /**
1788
1954
  * Win-back offer input for iOS 18+ (StoreKit 2)
1789
1955
  * Win-back offers are used to re-engage churned subscribers.