expo-iap 5.3.2 → 5.4.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/README.md +42 -16
- package/build/index.d.ts +13 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +25 -2
- package/build/index.js.map +1 -1
- package/build/index.kepler.d.ts +8 -0
- package/build/index.kepler.d.ts.map +1 -1
- package/build/index.kepler.js +9 -0
- package/build/index.kepler.js.map +1 -1
- package/build/modules/android.d.ts +3 -0
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js +3 -0
- package/build/modules/android.js.map +1 -1
- package/build/modules/ios.d.ts +3 -0
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js +3 -0
- package/build/modules/ios.js.map +1 -1
- package/build/types.d.ts +17 -2
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/useIAP.d.ts +5 -0
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +3 -2
- package/build/useIAP.js.map +1 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.kepler.ts +11 -0
- package/src/index.ts +34 -1
- package/src/modules/android.ts +3 -0
- package/src/modules/ios.ts +3 -0
- package/src/types.ts +17 -2
- package/src/useIAP.ts +8 -1
package/build/useIAP.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIAP.js","sourceRoot":"","sources":["../src/useIAP.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAGtC,mBAAmB;AACnB,OAAO,EACL,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,gCAAgC,EAChC,uCAAuC,EACvC,gCAAgC,EAChC,qBAAqB,EACrB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AoB,CAAC,wBAAwB,EAAE,MAAM,EAAE,CAAC;YACxD,oBAAoB,CAAC,+BAA+B,EAAE,MAAM,EAAE,CAAC;YAC/D,oBAAoB,CAAC,wBAAwB,EAAE,MAAM,EAAE,CAAC;YACxD,IAAI,kCAAkC,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC9D,kCAAkC,CAAC,OAAO,GAAG,CAAC,CAAC;gBAC/C,KAAK,aAAa,EAAE,CAAC;YACvB,CAAC;YACD,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAE/B,OAAO;QACL,SAAS;QACT,QAAQ;QACR,aAAa;QACb,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,qBAAqB,EAAE,6BAA6B;QACpD,aAAa,EAAE,qBAAqB;QACpC,eAAe,EAAE,wBAAwB;QACzC,cAAc;QACd,0BAA0B;QAC1B,gBAAgB,EAAE,wBAAwB;QAC1C,kDAAkD;QAClD,qBAAqB;QACrB,sBAAsB,EAAE,8BAA8B;QACtD,sBAAsB,EAAE,8BAA8B;QACtD,oCAAoC;QACpC,SAAS;QACT,2BAA2B;QAC3B,gCAAgC;QAChC,2CAA2C;QAC3C,yBAAyB;QACzB,0CAA0C;QAC1C,wBAAwB;QACxB,uCAAuC;QACvC,0BAA0B;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["// External dependencies\nimport {useCallback, useEffect, useState, useRef} from 'react';\nimport {Platform} from 'react-native';\nimport type {EventSubscription} from 'expo-modules-core';\n\n// Internal modules\nimport {\n endConnection,\n initConnection,\n purchaseErrorListener,\n purchaseUpdatedListener,\n promotedProductListenerIOS,\n userChoiceBillingListenerAndroid,\n developerProvidedBillingListenerAndroid,\n subscriptionBillingIssueListener,\n getAvailablePurchases,\n finishTransaction as finishTransactionInternal,\n requestPurchase as requestPurchaseInternal,\n fetchProducts,\n verifyPurchase as verifyPurchaseInternal,\n verifyPurchaseWithProvider as verifyPurchaseWithProviderInternal,\n getActiveSubscriptions,\n hasActiveSubscriptions,\n type ActiveSubscription,\n type ProductTypeInput,\n} from './index';\nimport {ExpoIapConsole} from './utils/debug';\nimport {getPromotedProductIOS} from './modules/ios';\nimport {restorePurchasesIOSNative} from './utils/restorePurchases';\nimport {\n getBillingChoiceInfoAndroid,\n isBillingProgramAvailableAndroid,\n createBillingProgramReportingDetailsAndroid,\n launchExternalLinkAndroid,\n showBillingProgramInformationDialogAndroid,\n showInAppMessagesAndroid,\n openRedeemOfferCodeAndroid,\n} from './modules/android';\n\n// Types\nimport type {\n Product,\n ProductSubscription,\n ProductQueryType,\n ProductRequest,\n BillingChoiceScreenTypeAndroid,\n BillingProgramAndroid,\n DeveloperProvidedBillingDetailsAndroid,\n InitConnectionConfig,\n Purchase,\n MutationRequestPurchaseArgs,\n PurchaseInput,\n PurchaseUpdatedListenerOptions,\n VerifyPurchaseProps,\n VerifyPurchaseResult,\n VerifyPurchaseWithProviderProps,\n VerifyPurchaseWithProviderResult,\n PurchaseOptions,\n MutationField,\n QueryField,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport type {PurchaseError} from './utils/errorMapping';\nimport {\n getUserFriendlyErrorMessage,\n isUserCancelledError,\n isRecoverableError,\n} from './utils/errorMapping';\n\nconst PURCHASE_DELIVERY_DEDUP_WINDOW_MS = 30_000;\n\nfunction getPurchaseDeliveryKey(purchase: Purchase): string {\n return [\n purchase.store ?? '',\n purchase.productId ?? '',\n purchase.purchaseToken ??\n purchase.transactionId ??\n purchase.id ??\n purchase.transactionDate ??\n '',\n ].join(':');\n}\n\ntype UseIap = {\n connected: boolean;\n products: Product[];\n subscriptions: ProductSubscription[];\n availablePurchases: Purchase[];\n promotedProductIOS?: Product;\n activeSubscriptions: ActiveSubscription[];\n finishTransaction: ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }) => Promise<void>;\n getAvailablePurchases: (options?: PurchaseOptions) => Promise<void>;\n fetchProducts: (params: {\n skus: string[];\n type?: ProductTypeInput;\n }) => Promise<void>;\n\n requestPurchase: (\n params: MutationRequestPurchaseArgs,\n ) => ReturnType<typeof requestPurchaseInternal>;\n verifyPurchase: (props: VerifyPurchaseProps) => Promise<VerifyPurchaseResult>;\n verifyPurchaseWithProvider: (\n props: VerifyPurchaseWithProviderProps,\n ) => Promise<VerifyPurchaseWithProviderResult>;\n restorePurchases: (options?: PurchaseOptions) => Promise<void>;\n getPromotedProductIOS: () => Promise<Product | null>;\n getActiveSubscriptions: (subscriptionIds?: string[]) => Promise<void>;\n hasActiveSubscriptions: (subscriptionIds?: string[]) => Promise<boolean>;\n /**\n * Manually retry the store connection.\n * Useful when the initial auto-connect fails (e.g., Play Store not ready at mount time).\n * Updates the `connected` state on success.\n */\n reconnect: () => Promise<boolean>;\n getBillingChoiceInfoAndroid: QueryField<'getBillingChoiceInfoAndroid'>;\n isBillingProgramAvailableAndroid: MutationField<'isBillingProgramAvailableAndroid'>;\n createBillingProgramReportingDetailsAndroid: MutationField<'createBillingProgramReportingDetailsAndroid'>;\n launchExternalLinkAndroid: MutationField<'launchExternalLinkAndroid'>;\n showBillingProgramInformationDialogAndroid: MutationField<'showBillingProgramInformationDialogAndroid'>;\n showInAppMessagesAndroid: MutationField<'showInAppMessagesAndroid'>;\n openRedeemOfferCodeAndroid: MutationField<'openRedeemOfferCodeAndroid'>;\n};\n\nexport interface UseIAPOptions {\n onPurchaseSuccess?: (purchase: Purchase) => void;\n onPurchaseError?: (error: PurchaseError) => void;\n /**\n * iOS only. When enabled, the purchase success listener also receives\n * StoreKit replay events for a transaction ID already delivered during the\n * current connection session. Defaults to false.\n */\n purchaseUpdatedListenerOptions?: PurchaseUpdatedListenerOptions | null;\n /**\n * Callback for general errors from hook methods like fetchProducts,\n * getAvailablePurchases, getActiveSubscriptions, restorePurchases, etc.\n * These are Promise-based operations that can fail due to network issues\n * or store unavailability.\n */\n onError?: (error: Error) => void;\n onPromotedProductIOS?: (product: Product) => void;\n onUserChoiceBillingAndroid?: (details: UserChoiceBillingDetails) => void;\n /**\n * Fires when the user selects developer-provided billing in an External\n * Payments or Google-rendered Billing Choice flow.\n */\n onDeveloperProvidedBillingAndroid?: (\n details: DeveloperProvidedBillingDetailsAndroid,\n ) => void;\n /** Fires when a subscription enters a billing-issue state. */\n onSubscriptionBillingIssue?: (purchase: Purchase) => void;\n /**\n * Enable a specific billing program for Android (8.2.0+)\n * When set, enables the specified billing program for external transactions.\n * Use 'external-payments' for Developer Provided Billing (Japan only, 8.3.0+).\n * Use 'user-choice-billing' for User Choice Billing (7.0+).\n * Use 'billing-choice' for Billing Choice (9.1.0+).\n */\n enableBillingProgramAndroid?: BillingProgramAndroid;\n /**\n * Select who renders the Billing Choice screen (9.1.0+). Must match the\n * choiceScreenType returned by isBillingProgramAvailableAndroid.\n */\n billingChoiceScreenTypeAndroid?: BillingChoiceScreenTypeAndroid;\n}\n\n/**\n * React Hook for managing In-App Purchases.\n * See documentation at https://openiap.dev/docs/setup/expo#useIAP-hook\n */\nexport function useIAP(options?: UseIAPOptions): UseIap {\n const [connected, setConnected] = useState<boolean>(false);\n const [products, setProducts] = useState<Product[]>([]);\n const [subscriptions, setSubscriptions] = useState<ProductSubscription[]>([]);\n\n const [availablePurchases, setAvailablePurchases] = useState<Purchase[]>([]);\n const [promotedProductIOS, setPromotedProductIOS] = useState<Product>();\n const [activeSubscriptions, setActiveSubscriptions] = useState<\n ActiveSubscription[]\n >([]);\n\n const optionsRef = useRef<UseIAPOptions | undefined>(options);\n const connectedRef = useRef<boolean>(false);\n const isMountedRef = useRef<boolean>(false);\n const initializationGenerationRef = useRef(0);\n const startedInitializationGenerationRef = useRef(0);\n const deliveredPurchaseKeysRef = useRef(new Set<string>());\n\n // Helper function to merge arrays with duplicate checking\n const mergeWithDuplicateCheck = useCallback(\n <T>(\n existingItems: T[],\n newItems: T[],\n getKey: (item: T) => string,\n ): T[] => {\n const merged = [...existingItems];\n newItems.forEach((newItem) => {\n const isDuplicate = merged.some(\n (existingItem) => getKey(existingItem) === getKey(newItem),\n );\n if (!isDuplicate) {\n merged.push(newItem);\n }\n });\n return merged;\n },\n [],\n );\n\n useEffect(() => {\n optionsRef.current = options;\n }, [options]);\n\n useEffect(() => {\n connectedRef.current = connected;\n }, [connected]);\n\n const subscriptionsRef = useRef<{\n purchaseUpdate?: EventSubscription;\n purchaseError?: EventSubscription;\n promotedProductIOS?: EventSubscription;\n userChoiceBillingAndroid?: EventSubscription;\n developerProvidedBillingAndroid?: EventSubscription;\n subscriptionBillingIssue?: EventSubscription;\n }>({});\n\n const subscriptionsRefState = useRef<ProductSubscription[]>([]);\n\n useEffect(() => {\n subscriptionsRefState.current = subscriptions;\n }, [subscriptions]);\n\n const normalizeProductQueryType = useCallback(\n (type?: ProductTypeInput): ProductQueryType => {\n if (!type || type === 'in-app') {\n return 'in-app';\n }\n return type;\n },\n [],\n );\n\n const canonicalProductType = useCallback(\n (value?: string): ProductQueryType => {\n if (!value) {\n return 'in-app';\n }\n\n const normalized = value.trim().toLowerCase().replace(/[_-]/g, '');\n return normalized === 'subs' ? 'subs' : 'in-app';\n },\n [],\n );\n\n const toPurchaseInput = useCallback(\n (purchase: Purchase): PurchaseInput => ({\n id: purchase.id,\n ids: purchase.ids ?? undefined,\n isAutoRenewing: purchase.isAutoRenewing,\n productId: purchase.productId,\n purchaseState: purchase.purchaseState,\n purchaseToken: purchase.purchaseToken ?? null,\n quantity: purchase.quantity,\n store: purchase.store,\n transactionDate: purchase.transactionDate,\n transactionId: purchase.transactionId,\n }),\n [],\n );\n\n const markPurchaseDelivered = useCallback((purchase: Purchase): boolean => {\n const key = getPurchaseDeliveryKey(purchase);\n if (deliveredPurchaseKeysRef.current.has(key)) {\n return false;\n }\n\n deliveredPurchaseKeysRef.current.add(key);\n setTimeout(() => {\n deliveredPurchaseKeysRef.current.delete(key);\n }, PURCHASE_DELIVERY_DEDUP_WINDOW_MS);\n return true;\n }, []);\n\n // Helper function to invoke onError callback\n const invokeOnError = useCallback((error: unknown) => {\n if (optionsRef.current?.onError) {\n optionsRef.current.onError(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n }, []);\n\n /**\n * Retrieve products or subscriptions from the store by SKU.\n *\n * @param params `ProductRequest` — `skus` (string[]) and optional `type`\n * (`'in-app' | 'subs' | 'all'`, defaults to `'in-app'`).\n * @returns Promise that resolves when the request is dispatched; results land in the\n * hook's reactive `products` / `subscriptions` state.\n * @throws When the store rejects the request (empty `skus`, not connected,\n * network/store error). Unknown SKUs are simply omitted from the result, not thrown.\n *\n * @example\n * ```ts\n * const { fetchProducts, products } = useIAP();\n * await fetchProducts({\n * skus: ['com.app.coins_100', 'com.app.premium'],\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks This is a regular promise-based call. Don't confuse with `request*` APIs\n * (`requestPurchase`), which are event-based.\n *\n * @see {@link https://openiap.dev/docs/apis/fetch-products}\n */\n const fetchProductsInternal = useCallback(\n async (params: {\n skus: string[];\n type?: ProductTypeInput;\n }): Promise<void> => {\n try {\n const queryType = normalizeProductQueryType(params.type);\n const request: ProductRequest = {skus: params.skus, type: queryType};\n const result = await fetchProducts(request);\n const items = (result ?? []) as (Product | ProductSubscription)[];\n\n ExpoIapConsole.debug('Fetched products:', items);\n\n if (queryType === 'subs') {\n const subscriptionsResult = items as ProductSubscription[];\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionsResult,\n (subscription) => subscription.id,\n ),\n );\n } else if (queryType === 'in-app') {\n const productsResult = items as Product[];\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productsResult,\n (product) => product.id,\n ),\n );\n } else {\n const productItems = items.filter(\n (item) => canonicalProductType(item.type as string) === 'in-app',\n ) as Product[];\n\n const subscriptionItems = items.filter(\n (item) => canonicalProductType(item.type as string) === 'subs',\n ) as ProductSubscription[];\n\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productItems,\n (product) => product.id,\n ),\n );\n\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionItems,\n (subscription) => subscription.id,\n ),\n );\n }\n } catch (error) {\n ExpoIapConsole.error('Error fetching products:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [\n canonicalProductType,\n invokeOnError,\n mergeWithDuplicateCheck,\n normalizeProductQueryType,\n ],\n );\n\n /**\n * List the user's unfinished purchases — non-consumables, active subscriptions, and any\n * pending transactions not yet finished.\n *\n * @param options Optional `PurchaseOptions`. iOS-only flags:\n * `alsoPublishToEventListenerIOS`, `onlyIncludeActiveItemsIOS`.\n * @returns Promise that resolves when the request is dispatched; results land in the\n * hook's reactive `availablePurchases` state.\n * @throws When the platform query fails.\n *\n * @example\n * ```ts\n * const { getAvailablePurchases, availablePurchases } = useIAP();\n * await getAvailablePurchases();\n * for (const p of availablePurchases) {\n * if (await verifyOnServer(p)) await finishTransaction({ purchase: p, isConsumable: false });\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/get-available-purchases}\n */\n const getAvailablePurchasesInternal = useCallback(\n async (options?: PurchaseOptions): Promise<void> => {\n try {\n const result = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n });\n setAvailablePurchases(result);\n } catch (error) {\n ExpoIapConsole.error('Error fetching available purchases:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Get details of all currently active subscriptions.\n *\n * @see {@link https://openiap.dev/docs/apis/get-active-subscriptions}\n */\n const getActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<void> => {\n try {\n const result = await getActiveSubscriptions(subscriptionIds);\n setActiveSubscriptions(result);\n } catch (error) {\n ExpoIapConsole.error('Error getting active subscriptions:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Check whether the user has any active subscription.\n *\n * @see {@link https://openiap.dev/docs/apis/has-active-subscriptions}\n */\n const hasActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<boolean> => {\n try {\n return await hasActiveSubscriptions(subscriptionIds);\n } catch (error) {\n ExpoIapConsole.error('Error checking active subscriptions:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Complete a purchase transaction. Call after server-side verification to remove it\n * from the queue.\n *\n * @param args.purchase The `Purchase` to finalize.\n * @param args.isConsumable `true` for consumables (consumes the token so the SKU can be\n * re-bought, e.g. coins); `false` (default) for non-consumables and subscriptions.\n * @returns Promise that resolves once the platform finalizes the transaction.\n * @throws When the platform finalize call fails.\n *\n * @example\n * ```ts\n * // Inside purchaseUpdatedListener:\n * if (await verifyOnServer(purchase)) {\n * await finishTransaction({ purchase, isConsumable: false });\n * }\n * ```\n *\n * @remarks **Critical:** Android purchases must be finalized within 3 days or Google\n * auto-refunds. iOS unfinished transactions replay on every app launch.\n *\n * @see {@link https://openiap.dev/docs/apis/finish-transaction}\n */\n const finishTransaction = useCallback(\n async ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }): Promise<void> => {\n await finishTransactionInternal({\n purchase: toPurchaseInput(purchase),\n isConsumable,\n });\n },\n [toPurchaseInput],\n );\n\n const refreshSubscriptionStatus = useCallback(\n async (productId: string) => {\n try {\n if (subscriptionsRefState.current.some((sub) => sub.id === productId)) {\n await fetchProductsInternal({skus: [productId], type: 'subs'});\n await getAvailablePurchasesInternal();\n await getActiveSubscriptionsInternal();\n }\n } catch (error) {\n ExpoIapConsole.warn('Failed to refresh subscription status:', error);\n }\n },\n [\n fetchProductsInternal,\n getAvailablePurchasesInternal,\n getActiveSubscriptionsInternal,\n ],\n );\n\n /**\n * Initiate a purchase or subscription flow. The result is delivered through\n * `purchaseUpdatedListener` — NOT the return value.\n *\n * @param props `RequestPurchaseProps`, discriminated by `type`:\n * - `type: 'in-app'` — pass `request.apple.sku` (iOS) and/or `request.google.skus` (Android).\n * - `type: 'subs'` — same shape, plus `request.google.subscriptionOffers: [{ sku, offerToken }]`.\n * @returns Promise that resolves when the request is dispatched; the actual purchase\n * outcome lands in the hook's `onPurchaseSuccess` / `onPurchaseError` callbacks.\n * @throws Synchronous rejection from the store (e.g. `E_NOT_PREPARED`, validation failure).\n *\n * @example\n * ```ts\n * await requestPurchase({\n * request: {\n * apple: { sku: 'com.app.premium' },\n * google: { skus: ['com.app.premium'] },\n * },\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks Event-based. Listen for the result via {@link purchaseUpdatedListener} /\n * {@link purchaseErrorListener}, or use `useIAP({ onPurchaseSuccess, onPurchaseError })`.\n *\n * @see {@link https://openiap.dev/docs/apis/request-purchase}\n */\n const requestPurchaseWithReset = useCallback(\n async (requestObj: MutationRequestPurchaseArgs) => {\n const purchaseResult = await requestPurchaseInternal(requestObj);\n const purchases = Array.isArray(purchaseResult)\n ? purchaseResult\n : purchaseResult\n ? [purchaseResult]\n : [];\n\n for (const purchase of purchases ?? []) {\n if (!markPurchaseDelivered(purchase)) {\n continue;\n }\n\n if (purchase.productId) {\n await refreshSubscriptionStatus(purchase.productId);\n }\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n }\n\n return purchaseResult;\n },\n [markPurchaseDelivered, refreshSubscriptionStatus],\n );\n\n /**\n * Restore non-consumable and active subscription purchases.\n *\n * @see {@link https://openiap.dev/docs/apis/restore-purchases}\n */\n const restorePurchasesInternal = useCallback(\n async (options?: PurchaseOptions): Promise<void> => {\n try {\n if (Platform.OS === 'ios') {\n await restorePurchasesIOSNative();\n }\n\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n });\n setAvailablePurchases(purchases);\n } catch (error) {\n ExpoIapConsole.warn('Failed to restore purchases:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Verify a purchase against your own backend (returns isValid + raw store metadata).\n *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase}\n */\n const verifyPurchase = useCallback(async (props: VerifyPurchaseProps) => {\n return verifyPurchaseInternal(props);\n }, []);\n\n /**\n * Verify via a managed provider — currently only `iapkit` (IAPKit). The PurchaseVerificationProvider enum exposes no other provider literal today.\n *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase-with-provider}\n */\n const verifyPurchaseWithProvider = useCallback(\n async (props: VerifyPurchaseWithProviderProps) => {\n return verifyPurchaseWithProviderInternal(props);\n },\n [],\n );\n\n // Build the canonical billing-program connection config.\n const buildConnectionConfig = useCallback(():\n | InitConnectionConfig\n | undefined => {\n if (optionsRef.current?.enableBillingProgramAndroid) {\n return {\n enableBillingProgramAndroid:\n optionsRef.current.enableBillingProgramAndroid,\n ...(optionsRef.current.billingChoiceScreenTypeAndroid\n ? {\n billingChoiceScreenTypeAndroid:\n optionsRef.current.billingChoiceScreenTypeAndroid,\n }\n : {}),\n };\n }\n\n return undefined;\n }, []);\n\n const initIapWithSubscriptions = useCallback(\n async (generation: number): Promise<void> => {\n if (\n !isMountedRef.current ||\n initializationGenerationRef.current !== generation\n ) {\n return;\n }\n startedInitializationGenerationRef.current = generation;\n\n // CRITICAL: Register listeners BEFORE initConnection to avoid race condition\n // Events might fire immediately after initConnection, so listeners must be ready\n // Register purchase update listener BEFORE initConnection to avoid race conditions.\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase) => {\n if (!markPurchaseDelivered(purchase)) {\n return;\n }\n\n // Refresh subscription status for both iOS and Android subscription purchases.\n // refreshSubscriptionStatus internally checks whether the product is a known\n // subscription, so it is safe to call unconditionally for any purchase event.\n await refreshSubscriptionStatus(purchase.productId);\n\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n },\n optionsRef.current?.purchaseUpdatedListenerOptions,\n );\n\n // Register purchase error listener EARLY. Ignore init-related errors until connected.\n subscriptionsRef.current.purchaseError = purchaseErrorListener(\n (error: PurchaseError) => {\n if (\n !connectedRef.current &&\n error.code === ErrorCode.InitConnection\n ) {\n return; // Ignore initialization error before connected\n }\n const friendly = getUserFriendlyErrorMessage(error);\n if (\n error?.code !== ErrorCode.AlreadyOwned &&\n error?.code !== ErrorCode.ServiceTimeout &&\n !isUserCancelledError(error) &&\n !isRecoverableError(error)\n ) {\n ExpoIapConsole.warn('[useIAP] Purchase error:', friendly);\n }\n\n if (optionsRef.current?.onPurchaseError) {\n optionsRef.current.onPurchaseError(error);\n }\n },\n );\n\n if (\n Platform.OS === 'android' &&\n optionsRef.current?.onUserChoiceBillingAndroid\n ) {\n subscriptionsRef.current.userChoiceBillingAndroid =\n userChoiceBillingListenerAndroid((details) => {\n optionsRef.current?.onUserChoiceBillingAndroid?.(details);\n });\n }\n\n if (\n Platform.OS === 'android' &&\n optionsRef.current?.onDeveloperProvidedBillingAndroid\n ) {\n subscriptionsRef.current.developerProvidedBillingAndroid =\n developerProvidedBillingListenerAndroid((details) => {\n optionsRef.current?.onDeveloperProvidedBillingAndroid?.(details);\n });\n }\n\n subscriptionsRef.current.subscriptionBillingIssue =\n subscriptionBillingIssueListener((purchase) => {\n optionsRef.current?.onSubscriptionBillingIssue?.(purchase);\n });\n\n if (Platform.OS === 'ios') {\n // iOS promoted products listener\n subscriptionsRef.current.promotedProductIOS =\n promotedProductListenerIOS((product: Product) => {\n setPromotedProductIOS(product);\n\n if (optionsRef.current?.onPromotedProductIOS) {\n optionsRef.current.onPromotedProductIOS(product);\n }\n });\n }\n\n // NOW call initConnection after listeners are ready\n const config = buildConnectionConfig();\n\n try {\n const result = await initConnection(config);\n if (\n !isMountedRef.current ||\n initializationGenerationRef.current !== generation\n ) {\n if (startedInitializationGenerationRef.current === generation) {\n startedInitializationGenerationRef.current = 0;\n await endConnection();\n }\n return;\n }\n setConnected(result);\n if (!result) {\n // If connection failed, clean up listeners\n ExpoIapConsole.warn(\n '[useIAP] Connection failed, cleaning up listeners...',\n );\n subscriptionsRef.current.purchaseUpdate?.remove();\n subscriptionsRef.current.promotedProductIOS?.remove();\n subscriptionsRef.current.purchaseUpdate = undefined;\n subscriptionsRef.current.promotedProductIOS = undefined;\n // Keep purchaseError listener registered to capture subsequent retries\n }\n } catch (error) {\n if (\n !isMountedRef.current ||\n initializationGenerationRef.current !== generation\n ) {\n return;\n }\n ExpoIapConsole.error('initConnection failed:', error);\n invokeOnError(error);\n // Clean up listeners on error\n subscriptionsRef.current.purchaseUpdate?.remove();\n subscriptionsRef.current.promotedProductIOS?.remove();\n subscriptionsRef.current.purchaseUpdate = undefined;\n subscriptionsRef.current.promotedProductIOS = undefined;\n }\n },\n [\n buildConnectionConfig,\n markPurchaseDelivered,\n refreshSubscriptionStatus,\n invokeOnError,\n ],\n );\n\n // Manual reconnect method for when the initial auto-connect fails.\n // Re-runs initConnection and updates the connected state.\n // Re-registers event listeners if they were cleaned up during a previous failure.\n const reconnect = useCallback(async (): Promise<boolean> => {\n const config = buildConnectionConfig();\n\n try {\n const result = await initConnection(config);\n setConnected(result);\n\n if (result) {\n // Re-register listeners if they were cleaned up during a previous failure\n if (!subscriptionsRef.current.purchaseUpdate) {\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase) => {\n if (!markPurchaseDelivered(purchase)) {\n return;\n }\n\n await refreshSubscriptionStatus(purchase.productId);\n\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n },\n optionsRef.current?.purchaseUpdatedListenerOptions,\n );\n }\n\n if (\n Platform.OS === 'ios' &&\n !subscriptionsRef.current.promotedProductIOS\n ) {\n subscriptionsRef.current.promotedProductIOS =\n promotedProductListenerIOS((product: Product) => {\n setPromotedProductIOS(product);\n\n if (optionsRef.current?.onPromotedProductIOS) {\n optionsRef.current.onPromotedProductIOS(product);\n }\n });\n }\n }\n\n return result;\n } catch (error) {\n ExpoIapConsole.error('[useIAP] reconnect failed:', error);\n invokeOnError(error);\n return false;\n }\n }, [\n buildConnectionConfig,\n markPurchaseDelivered,\n refreshSubscriptionStatus,\n invokeOnError,\n ]);\n\n useEffect(() => {\n const generation = ++initializationGenerationRef.current;\n isMountedRef.current = true;\n void Promise.resolve().then(() => initIapWithSubscriptions(generation));\n const currentSubscriptions = subscriptionsRef.current;\n\n return () => {\n isMountedRef.current = false;\n currentSubscriptions.purchaseUpdate?.remove();\n currentSubscriptions.purchaseError?.remove();\n currentSubscriptions.promotedProductIOS?.remove();\n currentSubscriptions.userChoiceBillingAndroid?.remove();\n currentSubscriptions.developerProvidedBillingAndroid?.remove();\n currentSubscriptions.subscriptionBillingIssue?.remove();\n if (startedInitializationGenerationRef.current === generation) {\n startedInitializationGenerationRef.current = 0;\n void endConnection();\n }\n setConnected(false);\n };\n }, [initIapWithSubscriptions]);\n\n return {\n connected,\n products,\n subscriptions,\n finishTransaction,\n availablePurchases,\n promotedProductIOS,\n activeSubscriptions,\n getAvailablePurchases: getAvailablePurchasesInternal,\n fetchProducts: fetchProductsInternal,\n requestPurchase: requestPurchaseWithReset,\n verifyPurchase,\n verifyPurchaseWithProvider,\n restorePurchases: restorePurchasesInternal,\n // internal getters kept for hook state management\n getPromotedProductIOS,\n getActiveSubscriptions: getActiveSubscriptionsInternal,\n hasActiveSubscriptions: hasActiveSubscriptionsInternal,\n // Reconnect method for manual retry\n reconnect,\n getBillingChoiceInfoAndroid,\n isBillingProgramAvailableAndroid,\n createBillingProgramReportingDetailsAndroid,\n launchExternalLinkAndroid,\n showBillingProgramInformationDialogAndroid,\n showInAppMessagesAndroid,\n // Offer code redemption (Android only)\n openRedeemOffer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yB;QACzB,0CAA0C;QAC1C,wBAAwB;QACxB,wBAAwB;QACxB,mBAAmB;QACnB,0BAA0B;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["// External dependencies\nimport {useCallback, useEffect, useState, useRef} from 'react';\nimport {Platform} from 'react-native';\nimport type {EventSubscription} from 'expo-modules-core';\n\n// Internal modules\nimport {\n endConnection,\n initConnection,\n purchaseErrorListener,\n purchaseUpdatedListener,\n promotedProductListenerIOS,\n userChoiceBillingListenerAndroid,\n developerProvidedBillingListenerAndroid,\n subscriptionBillingIssueListener,\n getAvailablePurchases,\n finishTransaction as finishTransactionInternal,\n requestPurchase as requestPurchaseInternal,\n fetchProducts,\n verifyPurchase as verifyPurchaseInternal,\n verifyPurchaseWithProvider as verifyPurchaseWithProviderInternal,\n getActiveSubscriptions,\n hasActiveSubscriptions,\n openRedeemOfferCode,\n type ActiveSubscription,\n type ProductTypeInput,\n} from './index';\nimport {ExpoIapConsole} from './utils/debug';\nimport {getPromotedProductIOS} from './modules/ios';\nimport {restorePurchasesIOSNative} from './utils/restorePurchases';\nimport {\n getBillingChoiceInfoAndroid,\n isBillingProgramAvailableAndroid,\n createBillingProgramReportingDetailsAndroid,\n launchExternalLinkAndroid,\n showBillingProgramInformationDialogAndroid,\n showInAppMessagesAndroid,\n openRedeemOfferCodeAndroid,\n} from './modules/android';\n\n// Types\nimport type {\n Product,\n ProductSubscription,\n ProductQueryType,\n ProductRequest,\n BillingChoiceScreenTypeAndroid,\n BillingProgramAndroid,\n DeveloperProvidedBillingDetailsAndroid,\n InitConnectionConfig,\n Purchase,\n MutationRequestPurchaseArgs,\n PurchaseInput,\n PurchaseUpdatedListenerOptions,\n VerifyPurchaseProps,\n VerifyPurchaseResult,\n VerifyPurchaseWithProviderProps,\n VerifyPurchaseWithProviderResult,\n PurchaseOptions,\n MutationField,\n QueryField,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport type {PurchaseError} from './utils/errorMapping';\nimport {\n getUserFriendlyErrorMessage,\n isUserCancelledError,\n isRecoverableError,\n} from './utils/errorMapping';\n\nconst PURCHASE_DELIVERY_DEDUP_WINDOW_MS = 30_000;\n\nfunction getPurchaseDeliveryKey(purchase: Purchase): string {\n return [\n purchase.store ?? '',\n purchase.productId ?? '',\n purchase.purchaseToken ??\n purchase.transactionId ??\n purchase.id ??\n purchase.transactionDate ??\n '',\n ].join(':');\n}\n\ntype UseIap = {\n connected: boolean;\n products: Product[];\n subscriptions: ProductSubscription[];\n availablePurchases: Purchase[];\n promotedProductIOS?: Product;\n activeSubscriptions: ActiveSubscription[];\n finishTransaction: ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }) => Promise<void>;\n getAvailablePurchases: (options?: PurchaseOptions) => Promise<void>;\n fetchProducts: (params: {\n skus: string[];\n type?: ProductTypeInput;\n }) => Promise<void>;\n\n requestPurchase: (\n params: MutationRequestPurchaseArgs,\n ) => ReturnType<typeof requestPurchaseInternal>;\n verifyPurchase: (props: VerifyPurchaseProps) => Promise<VerifyPurchaseResult>;\n verifyPurchaseWithProvider: (\n props: VerifyPurchaseWithProviderProps,\n ) => Promise<VerifyPurchaseWithProviderResult>;\n restorePurchases: (options?: PurchaseOptions) => Promise<void>;\n getPromotedProductIOS: () => Promise<Product | null>;\n getActiveSubscriptions: (subscriptionIds?: string[]) => Promise<void>;\n hasActiveSubscriptions: (subscriptionIds?: string[]) => Promise<boolean>;\n /**\n * Manually retry the store connection.\n * Useful when the initial auto-connect fails (e.g., Play Store not ready at mount time).\n * Updates the `connected` state on success.\n */\n reconnect: () => Promise<boolean>;\n getBillingChoiceInfoAndroid: QueryField<'getBillingChoiceInfoAndroid'>;\n isBillingProgramAvailableAndroid: MutationField<'isBillingProgramAvailableAndroid'>;\n createBillingProgramReportingDetailsAndroid: MutationField<'createBillingProgramReportingDetailsAndroid'>;\n launchExternalLinkAndroid: MutationField<'launchExternalLinkAndroid'>;\n showBillingProgramInformationDialogAndroid: MutationField<'showBillingProgramInformationDialogAndroid'>;\n showInAppMessagesAndroid: MutationField<'showInAppMessagesAndroid'>;\n openRedeemOfferCode: MutationField<'openRedeemOfferCode'>;\n /**\n * @deprecated Use `openRedeemOfferCode` instead. Scheduled for removal in\n * OpenIAP 4.0.\n */\n openRedeemOfferCodeAndroid: MutationField<'openRedeemOfferCodeAndroid'>;\n};\n\nexport interface UseIAPOptions {\n onPurchaseSuccess?: (purchase: Purchase) => void;\n onPurchaseError?: (error: PurchaseError) => void;\n /**\n * iOS only. When enabled, the purchase success listener also receives\n * StoreKit replay events for a transaction ID already delivered during the\n * current connection session. Defaults to false.\n */\n purchaseUpdatedListenerOptions?: PurchaseUpdatedListenerOptions | null;\n /**\n * Callback for general errors from hook methods like fetchProducts,\n * getAvailablePurchases, getActiveSubscriptions, restorePurchases, etc.\n * These are Promise-based operations that can fail due to network issues\n * or store unavailability.\n */\n onError?: (error: Error) => void;\n onPromotedProductIOS?: (product: Product) => void;\n onUserChoiceBillingAndroid?: (details: UserChoiceBillingDetails) => void;\n /**\n * Fires when the user selects developer-provided billing in an External\n * Payments or Google-rendered Billing Choice flow.\n */\n onDeveloperProvidedBillingAndroid?: (\n details: DeveloperProvidedBillingDetailsAndroid,\n ) => void;\n /** Fires when a subscription enters a billing-issue state. */\n onSubscriptionBillingIssue?: (purchase: Purchase) => void;\n /**\n * Enable a specific billing program for Android (8.2.0+)\n * When set, enables the specified billing program for external transactions.\n * Use 'external-payments' for Developer Provided Billing (Japan only, 8.3.0+).\n * Use 'user-choice-billing' for User Choice Billing (7.0+).\n * Use 'billing-choice' for Billing Choice (9.1.0+).\n */\n enableBillingProgramAndroid?: BillingProgramAndroid;\n /**\n * Select who renders the Billing Choice screen (9.1.0+). Must match the\n * choiceScreenType returned by isBillingProgramAvailableAndroid.\n */\n billingChoiceScreenTypeAndroid?: BillingChoiceScreenTypeAndroid;\n}\n\n/**\n * React Hook for managing In-App Purchases.\n * See documentation at https://openiap.dev/docs/setup/expo#useIAP-hook\n */\nexport function useIAP(options?: UseIAPOptions): UseIap {\n const [connected, setConnected] = useState<boolean>(false);\n const [products, setProducts] = useState<Product[]>([]);\n const [subscriptions, setSubscriptions] = useState<ProductSubscription[]>([]);\n\n const [availablePurchases, setAvailablePurchases] = useState<Purchase[]>([]);\n const [promotedProductIOS, setPromotedProductIOS] = useState<Product>();\n const [activeSubscriptions, setActiveSubscriptions] = useState<\n ActiveSubscription[]\n >([]);\n\n const optionsRef = useRef<UseIAPOptions | undefined>(options);\n const connectedRef = useRef<boolean>(false);\n const isMountedRef = useRef<boolean>(false);\n const initializationGenerationRef = useRef(0);\n const startedInitializationGenerationRef = useRef(0);\n const deliveredPurchaseKeysRef = useRef(new Set<string>());\n\n // Helper function to merge arrays with duplicate checking\n const mergeWithDuplicateCheck = useCallback(\n <T>(\n existingItems: T[],\n newItems: T[],\n getKey: (item: T) => string,\n ): T[] => {\n const merged = [...existingItems];\n newItems.forEach((newItem) => {\n const isDuplicate = merged.some(\n (existingItem) => getKey(existingItem) === getKey(newItem),\n );\n if (!isDuplicate) {\n merged.push(newItem);\n }\n });\n return merged;\n },\n [],\n );\n\n useEffect(() => {\n optionsRef.current = options;\n }, [options]);\n\n useEffect(() => {\n connectedRef.current = connected;\n }, [connected]);\n\n const subscriptionsRef = useRef<{\n purchaseUpdate?: EventSubscription;\n purchaseError?: EventSubscription;\n promotedProductIOS?: EventSubscription;\n userChoiceBillingAndroid?: EventSubscription;\n developerProvidedBillingAndroid?: EventSubscription;\n subscriptionBillingIssue?: EventSubscription;\n }>({});\n\n const subscriptionsRefState = useRef<ProductSubscription[]>([]);\n\n useEffect(() => {\n subscriptionsRefState.current = subscriptions;\n }, [subscriptions]);\n\n const normalizeProductQueryType = useCallback(\n (type?: ProductTypeInput): ProductQueryType => {\n if (!type || type === 'in-app') {\n return 'in-app';\n }\n return type;\n },\n [],\n );\n\n const canonicalProductType = useCallback(\n (value?: string): ProductQueryType => {\n if (!value) {\n return 'in-app';\n }\n\n const normalized = value.trim().toLowerCase().replace(/[_-]/g, '');\n return normalized === 'subs' ? 'subs' : 'in-app';\n },\n [],\n );\n\n const toPurchaseInput = useCallback(\n (purchase: Purchase): PurchaseInput => ({\n id: purchase.id,\n ids: purchase.ids ?? undefined,\n isAutoRenewing: purchase.isAutoRenewing,\n productId: purchase.productId,\n purchaseState: purchase.purchaseState,\n purchaseToken: purchase.purchaseToken ?? null,\n quantity: purchase.quantity,\n store: purchase.store,\n transactionDate: purchase.transactionDate,\n transactionId: purchase.transactionId,\n }),\n [],\n );\n\n const markPurchaseDelivered = useCallback((purchase: Purchase): boolean => {\n const key = getPurchaseDeliveryKey(purchase);\n if (deliveredPurchaseKeysRef.current.has(key)) {\n return false;\n }\n\n deliveredPurchaseKeysRef.current.add(key);\n setTimeout(() => {\n deliveredPurchaseKeysRef.current.delete(key);\n }, PURCHASE_DELIVERY_DEDUP_WINDOW_MS);\n return true;\n }, []);\n\n // Helper function to invoke onError callback\n const invokeOnError = useCallback((error: unknown) => {\n if (optionsRef.current?.onError) {\n optionsRef.current.onError(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n }, []);\n\n /**\n * Retrieve products or subscriptions from the store by SKU.\n *\n * @param params `ProductRequest` — `skus` (string[]) and optional `type`\n * (`'in-app' | 'subs' | 'all'`, defaults to `'in-app'`).\n * @returns Promise that resolves when the request is dispatched; results land in the\n * hook's reactive `products` / `subscriptions` state.\n * @throws When the store rejects the request (empty `skus`, not connected,\n * network/store error). Unknown SKUs are simply omitted from the result, not thrown.\n *\n * @example\n * ```ts\n * const { fetchProducts, products } = useIAP();\n * await fetchProducts({\n * skus: ['com.app.coins_100', 'com.app.premium'],\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks This is a regular promise-based call. Don't confuse with `request*` APIs\n * (`requestPurchase`), which are event-based.\n *\n * @see {@link https://openiap.dev/docs/apis/fetch-products}\n */\n const fetchProductsInternal = useCallback(\n async (params: {\n skus: string[];\n type?: ProductTypeInput;\n }): Promise<void> => {\n try {\n const queryType = normalizeProductQueryType(params.type);\n const request: ProductRequest = {skus: params.skus, type: queryType};\n const result = await fetchProducts(request);\n const items = (result ?? []) as (Product | ProductSubscription)[];\n\n ExpoIapConsole.debug('Fetched products:', items);\n\n if (queryType === 'subs') {\n const subscriptionsResult = items as ProductSubscription[];\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionsResult,\n (subscription) => subscription.id,\n ),\n );\n } else if (queryType === 'in-app') {\n const productsResult = items as Product[];\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productsResult,\n (product) => product.id,\n ),\n );\n } else {\n const productItems = items.filter(\n (item) => canonicalProductType(item.type as string) === 'in-app',\n ) as Product[];\n\n const subscriptionItems = items.filter(\n (item) => canonicalProductType(item.type as string) === 'subs',\n ) as ProductSubscription[];\n\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productItems,\n (product) => product.id,\n ),\n );\n\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionItems,\n (subscription) => subscription.id,\n ),\n );\n }\n } catch (error) {\n ExpoIapConsole.error('Error fetching products:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [\n canonicalProductType,\n invokeOnError,\n mergeWithDuplicateCheck,\n normalizeProductQueryType,\n ],\n );\n\n /**\n * List the user's unfinished purchases — non-consumables, active subscriptions, and any\n * pending transactions not yet finished.\n *\n * @param options Optional `PurchaseOptions`. iOS-only flags:\n * `alsoPublishToEventListenerIOS`, `onlyIncludeActiveItemsIOS`.\n * @returns Promise that resolves when the request is dispatched; results land in the\n * hook's reactive `availablePurchases` state.\n * @throws When the platform query fails.\n *\n * @example\n * ```ts\n * const { getAvailablePurchases, availablePurchases } = useIAP();\n * await getAvailablePurchases();\n * for (const p of availablePurchases) {\n * if (await verifyOnServer(p)) await finishTransaction({ purchase: p, isConsumable: false });\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/get-available-purchases}\n */\n const getAvailablePurchasesInternal = useCallback(\n async (options?: PurchaseOptions): Promise<void> => {\n try {\n const result = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n });\n setAvailablePurchases(result);\n } catch (error) {\n ExpoIapConsole.error('Error fetching available purchases:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Get details of all currently active subscriptions.\n *\n * @see {@link https://openiap.dev/docs/apis/get-active-subscriptions}\n */\n const getActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<void> => {\n try {\n const result = await getActiveSubscriptions(subscriptionIds);\n setActiveSubscriptions(result);\n } catch (error) {\n ExpoIapConsole.error('Error getting active subscriptions:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Check whether the user has any active subscription.\n *\n * @see {@link https://openiap.dev/docs/apis/has-active-subscriptions}\n */\n const hasActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<boolean> => {\n try {\n return await hasActiveSubscriptions(subscriptionIds);\n } catch (error) {\n ExpoIapConsole.error('Error checking active subscriptions:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Complete a purchase transaction. Call after server-side verification to remove it\n * from the queue.\n *\n * @param args.purchase The `Purchase` to finalize.\n * @param args.isConsumable `true` for consumables (consumes the token so the SKU can be\n * re-bought, e.g. coins); `false` (default) for non-consumables and subscriptions.\n * @returns Promise that resolves once the platform finalizes the transaction.\n * @throws When the platform finalize call fails.\n *\n * @example\n * ```ts\n * // Inside purchaseUpdatedListener:\n * if (await verifyOnServer(purchase)) {\n * await finishTransaction({ purchase, isConsumable: false });\n * }\n * ```\n *\n * @remarks **Critical:** Android purchases must be finalized within 3 days or Google\n * auto-refunds. iOS unfinished transactions replay on every app launch.\n *\n * @see {@link https://openiap.dev/docs/apis/finish-transaction}\n */\n const finishTransaction = useCallback(\n async ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }): Promise<void> => {\n await finishTransactionInternal({\n purchase: toPurchaseInput(purchase),\n isConsumable,\n });\n },\n [toPurchaseInput],\n );\n\n const refreshSubscriptionStatus = useCallback(\n async (productId: string) => {\n try {\n if (subscriptionsRefState.current.some((sub) => sub.id === productId)) {\n await fetchProductsInternal({skus: [productId], type: 'subs'});\n await getAvailablePurchasesInternal();\n await getActiveSubscriptionsInternal();\n }\n } catch (error) {\n ExpoIapConsole.warn('Failed to refresh subscription status:', error);\n }\n },\n [\n fetchProductsInternal,\n getAvailablePurchasesInternal,\n getActiveSubscriptionsInternal,\n ],\n );\n\n /**\n * Initiate a purchase or subscription flow. The result is delivered through\n * `purchaseUpdatedListener` — NOT the return value.\n *\n * @param props `RequestPurchaseProps`, discriminated by `type`:\n * - `type: 'in-app'` — pass `request.apple.sku` (iOS) and/or `request.google.skus` (Android).\n * - `type: 'subs'` — same shape, plus `request.google.subscriptionOffers: [{ sku, offerToken }]`.\n * @returns Promise that resolves when the request is dispatched; the actual purchase\n * outcome lands in the hook's `onPurchaseSuccess` / `onPurchaseError` callbacks.\n * @throws Synchronous rejection from the store (e.g. `E_NOT_PREPARED`, validation failure).\n *\n * @example\n * ```ts\n * await requestPurchase({\n * request: {\n * apple: { sku: 'com.app.premium' },\n * google: { skus: ['com.app.premium'] },\n * },\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks Event-based. Listen for the result via {@link purchaseUpdatedListener} /\n * {@link purchaseErrorListener}, or use `useIAP({ onPurchaseSuccess, onPurchaseError })`.\n *\n * @see {@link https://openiap.dev/docs/apis/request-purchase}\n */\n const requestPurchaseWithReset = useCallback(\n async (requestObj: MutationRequestPurchaseArgs) => {\n const purchaseResult = await requestPurchaseInternal(requestObj);\n const purchases = Array.isArray(purchaseResult)\n ? purchaseResult\n : purchaseResult\n ? [purchaseResult]\n : [];\n\n for (const purchase of purchases ?? []) {\n if (!markPurchaseDelivered(purchase)) {\n continue;\n }\n\n if (purchase.productId) {\n await refreshSubscriptionStatus(purchase.productId);\n }\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n }\n\n return purchaseResult;\n },\n [markPurchaseDelivered, refreshSubscriptionStatus],\n );\n\n /**\n * Restore non-consumable and active subscription purchases.\n *\n * @see {@link https://openiap.dev/docs/apis/restore-purchases}\n */\n const restorePurchasesInternal = useCallback(\n async (options?: PurchaseOptions): Promise<void> => {\n try {\n if (Platform.OS === 'ios') {\n await restorePurchasesIOSNative();\n }\n\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n });\n setAvailablePurchases(purchases);\n } catch (error) {\n ExpoIapConsole.warn('Failed to restore purchases:', error);\n invokeOnError(error);\n throw error;\n }\n },\n [invokeOnError],\n );\n\n /**\n * Verify a purchase against your own backend (returns isValid + raw store metadata).\n *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase}\n */\n const verifyPurchase = useCallback(async (props: VerifyPurchaseProps) => {\n return verifyPurchaseInternal(props);\n }, []);\n\n /**\n * Verify via a managed provider — currently only `iapkit` (IAPKit). The PurchaseVerificationProvider enum exposes no other provider literal today.\n *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase-with-provider}\n */\n const verifyPurchaseWithProvider = useCallback(\n async (props: VerifyPurchaseWithProviderProps) => {\n return verifyPurchaseWithProviderInternal(props);\n },\n [],\n );\n\n // Build the canonical billing-program connection config.\n const buildConnectionConfig = useCallback(():\n | InitConnectionConfig\n | undefined => {\n if (optionsRef.current?.enableBillingProgramAndroid) {\n return {\n enableBillingProgramAndroid:\n optionsRef.current.enableBillingProgramAndroid,\n ...(optionsRef.current.billingChoiceScreenTypeAndroid\n ? {\n billingChoiceScreenTypeAndroid:\n optionsRef.current.billingChoiceScreenTypeAndroid,\n }\n : {}),\n };\n }\n\n return undefined;\n }, []);\n\n const initIapWithSubscriptions = useCallback(\n async (generation: number): Promise<void> => {\n if (\n !isMountedRef.current ||\n initializationGenerationRef.current !== generation\n ) {\n return;\n }\n startedInitializationGenerationRef.current = generation;\n\n // CRITICAL: Register listeners BEFORE initConnection to avoid race condition\n // Events might fire immediately after initConnection, so listeners must be ready\n // Register purchase update listener BEFORE initConnection to avoid race conditions.\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase) => {\n if (!markPurchaseDelivered(purchase)) {\n return;\n }\n\n // Refresh subscription status for both iOS and Android subscription purchases.\n // refreshSubscriptionStatus internally checks whether the product is a known\n // subscription, so it is safe to call unconditionally for any purchase event.\n await refreshSubscriptionStatus(purchase.productId);\n\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n },\n optionsRef.current?.purchaseUpdatedListenerOptions,\n );\n\n // Register purchase error listener EARLY. Ignore init-related errors until connected.\n subscriptionsRef.current.purchaseError = purchaseErrorListener(\n (error: PurchaseError) => {\n if (\n !connectedRef.current &&\n error.code === ErrorCode.InitConnection\n ) {\n return; // Ignore initialization error before connected\n }\n const friendly = getUserFriendlyErrorMessage(error);\n if (\n error?.code !== ErrorCode.AlreadyOwned &&\n error?.code !== ErrorCode.ServiceTimeout &&\n !isUserCancelledError(error) &&\n !isRecoverableError(error)\n ) {\n ExpoIapConsole.warn('[useIAP] Purchase error:', friendly);\n }\n\n if (optionsRef.current?.onPurchaseError) {\n optionsRef.current.onPurchaseError(error);\n }\n },\n );\n\n if (\n Platform.OS === 'android' &&\n optionsRef.current?.onUserChoiceBillingAndroid\n ) {\n subscriptionsRef.current.userChoiceBillingAndroid =\n userChoiceBillingListenerAndroid((details) => {\n optionsRef.current?.onUserChoiceBillingAndroid?.(details);\n });\n }\n\n if (\n Platform.OS === 'android' &&\n optionsRef.current?.onDeveloperProvidedBillingAndroid\n ) {\n subscriptionsRef.current.developerProvidedBillingAndroid =\n developerProvidedBillingListenerAndroid((details) => {\n optionsRef.current?.onDeveloperProvidedBillingAndroid?.(details);\n });\n }\n\n subscriptionsRef.current.subscriptionBillingIssue =\n subscriptionBillingIssueListener((purchase) => {\n optionsRef.current?.onSubscriptionBillingIssue?.(purchase);\n });\n\n if (Platform.OS === 'ios') {\n // iOS promoted products listener\n subscriptionsRef.current.promotedProductIOS =\n promotedProductListenerIOS((product: Product) => {\n setPromotedProductIOS(product);\n\n if (optionsRef.current?.onPromotedProductIOS) {\n optionsRef.current.onPromotedProductIOS(product);\n }\n });\n }\n\n // NOW call initConnection after listeners are ready\n const config = buildConnectionConfig();\n\n try {\n const result = await initConnection(config);\n if (\n !isMountedRef.current ||\n initializationGenerationRef.current !== generation\n ) {\n if (startedInitializationGenerationRef.current === generation) {\n startedInitializationGenerationRef.current = 0;\n await endConnection();\n }\n return;\n }\n setConnected(result);\n if (!result) {\n // If connection failed, clean up listeners\n ExpoIapConsole.warn(\n '[useIAP] Connection failed, cleaning up listeners...',\n );\n subscriptionsRef.current.purchaseUpdate?.remove();\n subscriptionsRef.current.promotedProductIOS?.remove();\n subscriptionsRef.current.purchaseUpdate = undefined;\n subscriptionsRef.current.promotedProductIOS = undefined;\n // Keep purchaseError listener registered to capture subsequent retries\n }\n } catch (error) {\n if (\n !isMountedRef.current ||\n initializationGenerationRef.current !== generation\n ) {\n return;\n }\n ExpoIapConsole.error('initConnection failed:', error);\n invokeOnError(error);\n // Clean up listeners on error\n subscriptionsRef.current.purchaseUpdate?.remove();\n subscriptionsRef.current.promotedProductIOS?.remove();\n subscriptionsRef.current.purchaseUpdate = undefined;\n subscriptionsRef.current.promotedProductIOS = undefined;\n }\n },\n [\n buildConnectionConfig,\n markPurchaseDelivered,\n refreshSubscriptionStatus,\n invokeOnError,\n ],\n );\n\n // Manual reconnect method for when the initial auto-connect fails.\n // Re-runs initConnection and updates the connected state.\n // Re-registers event listeners if they were cleaned up during a previous failure.\n const reconnect = useCallback(async (): Promise<boolean> => {\n const config = buildConnectionConfig();\n\n try {\n const result = await initConnection(config);\n setConnected(result);\n\n if (result) {\n // Re-register listeners if they were cleaned up during a previous failure\n if (!subscriptionsRef.current.purchaseUpdate) {\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase) => {\n if (!markPurchaseDelivered(purchase)) {\n return;\n }\n\n await refreshSubscriptionStatus(purchase.productId);\n\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n },\n optionsRef.current?.purchaseUpdatedListenerOptions,\n );\n }\n\n if (\n Platform.OS === 'ios' &&\n !subscriptionsRef.current.promotedProductIOS\n ) {\n subscriptionsRef.current.promotedProductIOS =\n promotedProductListenerIOS((product: Product) => {\n setPromotedProductIOS(product);\n\n if (optionsRef.current?.onPromotedProductIOS) {\n optionsRef.current.onPromotedProductIOS(product);\n }\n });\n }\n }\n\n return result;\n } catch (error) {\n ExpoIapConsole.error('[useIAP] reconnect failed:', error);\n invokeOnError(error);\n return false;\n }\n }, [\n buildConnectionConfig,\n markPurchaseDelivered,\n refreshSubscriptionStatus,\n invokeOnError,\n ]);\n\n useEffect(() => {\n const generation = ++initializationGenerationRef.current;\n isMountedRef.current = true;\n void Promise.resolve().then(() => initIapWithSubscriptions(generation));\n const currentSubscriptions = subscriptionsRef.current;\n\n return () => {\n isMountedRef.current = false;\n currentSubscriptions.purchaseUpdate?.remove();\n currentSubscriptions.purchaseError?.remove();\n currentSubscriptions.promotedProductIOS?.remove();\n currentSubscriptions.userChoiceBillingAndroid?.remove();\n currentSubscriptions.developerProvidedBillingAndroid?.remove();\n currentSubscriptions.subscriptionBillingIssue?.remove();\n if (startedInitializationGenerationRef.current === generation) {\n startedInitializationGenerationRef.current = 0;\n void endConnection();\n }\n setConnected(false);\n };\n }, [initIapWithSubscriptions]);\n\n return {\n connected,\n products,\n subscriptions,\n finishTransaction,\n availablePurchases,\n promotedProductIOS,\n activeSubscriptions,\n getAvailablePurchases: getAvailablePurchasesInternal,\n fetchProducts: fetchProductsInternal,\n requestPurchase: requestPurchaseWithReset,\n verifyPurchase,\n verifyPurchaseWithProvider,\n restorePurchases: restorePurchasesInternal,\n // internal getters kept for hook state management\n getPromotedProductIOS,\n getActiveSubscriptions: getActiveSubscriptionsInternal,\n hasActiveSubscriptions: hasActiveSubscriptionsInternal,\n // Reconnect method for manual retry\n reconnect,\n getBillingChoiceInfoAndroid,\n isBillingProgramAvailableAndroid,\n createBillingProgramReportingDetailsAndroid,\n launchExternalLinkAndroid,\n showBillingProgramInformationDialogAndroid,\n showInAppMessagesAndroid,\n // Offer code redemption\n openRedeemOfferCode,\n openRedeemOfferCodeAndroid,\n };\n}\n"]}
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED
package/src/index.kepler.ts
CHANGED
|
@@ -253,6 +253,9 @@ export const getPromotedProductIOS: QueryField<
|
|
|
253
253
|
export const showManageSubscriptionsIOS: MutationField<
|
|
254
254
|
'showManageSubscriptionsIOS'
|
|
255
255
|
> = async () => [];
|
|
256
|
+
/**
|
|
257
|
+
* @deprecated Use `openRedeemOfferCode` instead. Scheduled for removal in OpenIAP 4.0.
|
|
258
|
+
*/
|
|
256
259
|
export const presentCodeRedemptionSheetIOS: MutationField<
|
|
257
260
|
'presentCodeRedemptionSheetIOS'
|
|
258
261
|
> = async () => null;
|
|
@@ -263,6 +266,14 @@ export const presentExternalPurchaseLinkIOS: MutationField<
|
|
|
263
266
|
export const deepLinkToSubscriptions: MutationField<
|
|
264
267
|
'deepLinkToSubscriptions'
|
|
265
268
|
> = async () => unsupported('deepLinkToSubscriptions');
|
|
269
|
+
// Vega has no offer-code redemption surface; resolve null without launching.
|
|
270
|
+
export const openRedeemOfferCode: MutationField<
|
|
271
|
+
'openRedeemOfferCode'
|
|
272
|
+
> = async () => null;
|
|
273
|
+
/**
|
|
274
|
+
* @deprecated Use `openRedeemOfferCode` instead. Scheduled for removal in
|
|
275
|
+
* OpenIAP 4.0.
|
|
276
|
+
*/
|
|
266
277
|
export const openRedeemOfferCodeAndroid: MutationField<
|
|
267
278
|
'openRedeemOfferCodeAndroid'
|
|
268
279
|
> = async () => false;
|
package/src/index.ts
CHANGED
|
@@ -4,10 +4,15 @@ import {Platform} from 'react-native';
|
|
|
4
4
|
// Internal modules
|
|
5
5
|
import ExpoIapModule, {getNativeModule} from './ExpoIapModule';
|
|
6
6
|
import {isVegaOS} from './vega';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
isProductIOS,
|
|
9
|
+
deepLinkToSubscriptionsIOS,
|
|
10
|
+
presentCodeRedemptionSheetIOS,
|
|
11
|
+
} from './modules/ios';
|
|
8
12
|
import {
|
|
9
13
|
isProductAndroid,
|
|
10
14
|
deepLinkToSubscriptionsAndroid,
|
|
15
|
+
openRedeemOfferCodeAndroid,
|
|
11
16
|
} from './modules/android';
|
|
12
17
|
import {ExpoIapConsole} from './utils/debug';
|
|
13
18
|
import {restorePurchasesIOSNative} from './utils/restorePurchases';
|
|
@@ -1301,6 +1306,34 @@ export const deepLinkToSubscriptions: MutationField<
|
|
|
1301
1306
|
throw unsupportedPlatformError();
|
|
1302
1307
|
};
|
|
1303
1308
|
|
|
1309
|
+
/**
|
|
1310
|
+
* Open the platform's offer/promo code redemption flow.
|
|
1311
|
+
*
|
|
1312
|
+
* Resolves the redeemed purchase only when the store reports it synchronously;
|
|
1313
|
+
* every other path resolves null, so reconcile with `getAvailablePurchases`
|
|
1314
|
+
* when the app resumes.
|
|
1315
|
+
*
|
|
1316
|
+
* @returns Promise resolving to the redeemed purchase, or null
|
|
1317
|
+
* @throws Error when a redemption flow exists but cannot be opened
|
|
1318
|
+
*
|
|
1319
|
+
* @see {@link https://openiap.dev/docs/apis/open-redeem-offer-code}
|
|
1320
|
+
*/
|
|
1321
|
+
export const openRedeemOfferCode: MutationField<
|
|
1322
|
+
'openRedeemOfferCode'
|
|
1323
|
+
> = async () => {
|
|
1324
|
+
if (Platform.OS === 'ios') {
|
|
1325
|
+
return presentCodeRedemptionSheetIOS();
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
if (isAndroidStoreRuntime()) {
|
|
1329
|
+
// Native returns Boolean; false also maps to null until the SDK adopts openiap-google 3.4.0.
|
|
1330
|
+
await openRedeemOfferCodeAndroid();
|
|
1331
|
+
return null;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
throw unsupportedPlatformError();
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1304
1337
|
/**
|
|
1305
1338
|
* Verify purchase with the configured providers
|
|
1306
1339
|
*
|
package/src/modules/android.ts
CHANGED
|
@@ -177,6 +177,9 @@ export const acknowledgePurchaseAndroid: MutationField<
|
|
|
177
177
|
*
|
|
178
178
|
* @returns Promise resolving to true when launched, or false when unsupported
|
|
179
179
|
*
|
|
180
|
+
* @deprecated Use `openRedeemOfferCode` instead. Scheduled for removal in
|
|
181
|
+
* OpenIAP 4.0.
|
|
182
|
+
*
|
|
180
183
|
* @see {@link https://openiap.dev/docs/apis/android/open-redeem-offer-code-android}
|
|
181
184
|
*/
|
|
182
185
|
export const openRedeemOfferCodeAndroid: MutationField<
|
package/src/modules/ios.ts
CHANGED
|
@@ -290,6 +290,9 @@ export const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (
|
|
|
290
290
|
*
|
|
291
291
|
* @platform iOS
|
|
292
292
|
*
|
|
293
|
+
* @deprecated Use `openRedeemOfferCode` instead. Scheduled for removal in
|
|
294
|
+
* OpenIAP 4.0.
|
|
295
|
+
*
|
|
293
296
|
* @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}
|
|
294
297
|
*/
|
|
295
298
|
export const presentCodeRedemptionSheetIOS: MutationField<
|
package/src/types.ts
CHANGED
|
@@ -801,7 +801,18 @@ export interface Mutation {
|
|
|
801
801
|
*/
|
|
802
802
|
launchExternalLinkAndroid: Promise<boolean>;
|
|
803
803
|
/**
|
|
804
|
-
* Open the
|
|
804
|
+
* Open the platform's offer/promo code redemption flow.
|
|
805
|
+
* Resolves the redeemed purchase only when the store reports it synchronously;
|
|
806
|
+
* every other path resolves null, so reconcile through the purchase listeners.
|
|
807
|
+
* Throws when a redemption flow exists but cannot be opened.
|
|
808
|
+
* Available in OpenIAP Spec 3.3.0 / openiap-apple 3.3.0 / openiap-google 3.4.0.
|
|
809
|
+
* Replaces presentCodeRedemptionSheetIOS and openRedeemOfferCodeAndroid.
|
|
810
|
+
* See: https://openiap.dev/docs/apis/open-redeem-offer-code
|
|
811
|
+
*/
|
|
812
|
+
openRedeemOfferCode?: Promise<(Purchase | null)>;
|
|
813
|
+
/**
|
|
814
|
+
* Deprecated. Open the Google Play offer/promo code redemption flow — use
|
|
815
|
+
* openRedeemOfferCode instead.
|
|
805
816
|
* On Google Play builds, launches the Play Store redeem page
|
|
806
817
|
* (https://play.google.com/redeem). A purchase listener can receive the redeemed
|
|
807
818
|
* purchase while the app is running with an active billing connection; always
|
|
@@ -812,10 +823,12 @@ export interface Mutation {
|
|
|
812
823
|
* Returns true when the redemption flow was launched, or false when the current
|
|
813
824
|
* store flavor does not provide an equivalent redemption flow.
|
|
814
825
|
* See: https://openiap.dev/docs/apis/android/open-redeem-offer-code-android
|
|
826
|
+
* @deprecated Use openRedeemOfferCode. Scheduled for removal in OpenIAP 4.0.
|
|
815
827
|
*/
|
|
816
828
|
openRedeemOfferCodeAndroid: Promise<boolean>;
|
|
817
829
|
/**
|
|
818
|
-
* Show the App Store offer code redemption sheet
|
|
830
|
+
* Deprecated. Show the App Store offer code redemption sheet — use
|
|
831
|
+
* openRedeemOfferCode instead.
|
|
819
832
|
* When built with Xcode 27+ and running on iOS 27+, Mac Catalyst 27+, or
|
|
820
833
|
* visionOS 27+, returns the verified transaction produced by the redemption.
|
|
821
834
|
* StoreKit 2's scene-based sheet returns null after presentation on iOS 16–26,
|
|
@@ -826,6 +839,7 @@ export interface Mutation {
|
|
|
826
839
|
* sheet through the normal transaction listener or an explicit
|
|
827
840
|
* available-purchases refresh.
|
|
828
841
|
* See: https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios
|
|
842
|
+
* @deprecated Use openRedeemOfferCode. Scheduled for removal in OpenIAP 4.0.
|
|
829
843
|
*/
|
|
830
844
|
presentCodeRedemptionSheetIOS?: Promise<(PurchaseIOS | null)>;
|
|
831
845
|
/**
|
|
@@ -2298,6 +2312,7 @@ export type MutationArgsMap = {
|
|
|
2298
2312
|
initConnection: MutationInitConnectionArgs;
|
|
2299
2313
|
isBillingProgramAvailableAndroid: MutationIsBillingProgramAvailableAndroidArgs;
|
|
2300
2314
|
launchExternalLinkAndroid: MutationLaunchExternalLinkAndroidArgs;
|
|
2315
|
+
openRedeemOfferCode: never;
|
|
2301
2316
|
openRedeemOfferCodeAndroid: never;
|
|
2302
2317
|
presentCodeRedemptionSheetIOS: never;
|
|
2303
2318
|
presentExternalPurchaseLinkIOS: MutationPresentExternalPurchaseLinkIosArgs;
|
package/src/useIAP.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
verifyPurchaseWithProvider as verifyPurchaseWithProviderInternal,
|
|
22
22
|
getActiveSubscriptions,
|
|
23
23
|
hasActiveSubscriptions,
|
|
24
|
+
openRedeemOfferCode,
|
|
24
25
|
type ActiveSubscription,
|
|
25
26
|
type ProductTypeInput,
|
|
26
27
|
} from './index';
|
|
@@ -125,6 +126,11 @@ type UseIap = {
|
|
|
125
126
|
launchExternalLinkAndroid: MutationField<'launchExternalLinkAndroid'>;
|
|
126
127
|
showBillingProgramInformationDialogAndroid: MutationField<'showBillingProgramInformationDialogAndroid'>;
|
|
127
128
|
showInAppMessagesAndroid: MutationField<'showInAppMessagesAndroid'>;
|
|
129
|
+
openRedeemOfferCode: MutationField<'openRedeemOfferCode'>;
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated Use `openRedeemOfferCode` instead. Scheduled for removal in
|
|
132
|
+
* OpenIAP 4.0.
|
|
133
|
+
*/
|
|
128
134
|
openRedeemOfferCodeAndroid: MutationField<'openRedeemOfferCodeAndroid'>;
|
|
129
135
|
};
|
|
130
136
|
|
|
@@ -897,7 +903,8 @@ export function useIAP(options?: UseIAPOptions): UseIap {
|
|
|
897
903
|
launchExternalLinkAndroid,
|
|
898
904
|
showBillingProgramInformationDialogAndroid,
|
|
899
905
|
showInAppMessagesAndroid,
|
|
900
|
-
// Offer code redemption
|
|
906
|
+
// Offer code redemption
|
|
907
|
+
openRedeemOfferCode,
|
|
901
908
|
openRedeemOfferCodeAndroid,
|
|
902
909
|
};
|
|
903
910
|
}
|