import { requestPurchase as requestPurchaseInternal, type ActiveSubscription, type ProductTypeInput } from './index'; import type { PurchaseFlow, PurchaseFlowOutcome } from './purchase-flow-core'; import type { Product, ProductSubscription, BillingChoiceScreenTypeAndroid, BillingProgramAndroid, DeveloperProvidedBillingDetailsAndroid, Purchase, MutationRequestPurchaseArgs, PurchaseUpdatedListenerOptions, VerifyPurchaseProps, VerifyPurchaseResult, VerifyPurchaseWithProviderProps, VerifyPurchaseWithProviderResult, PurchaseOptions, MutationField, QueryField, UserChoiceBillingDetails } from './types'; import type { PurchaseError } from './utils/errorMapping'; type UseIap = { connected: boolean; products: Product[]; subscriptions: ProductSubscription[]; availablePurchases: Purchase[]; promotedProductIOS?: Product; activeSubscriptions: ActiveSubscription[]; finishTransaction: ({ purchase, isConsumable, }: { purchase: Purchase; isConsumable?: boolean; }) => Promise; getAvailablePurchases: (options?: PurchaseOptions) => Promise; fetchProducts: (params: { skus: string[]; type?: ProductTypeInput; }) => Promise; requestPurchase: (params: MutationRequestPurchaseArgs) => ReturnType; verifyPurchase: (props: VerifyPurchaseProps) => Promise; verifyPurchaseWithProvider: (props: VerifyPurchaseWithProviderProps) => Promise; restorePurchases: (options?: PurchaseOptions) => Promise; getPromotedProductIOS: () => Promise; getActiveSubscriptions: (subscriptionIds?: string[]) => Promise; hasActiveSubscriptions: (subscriptionIds?: string[]) => Promise; /** * Manually retry the store connection. * Useful when the initial auto-connect fails (e.g., Play Store not ready at mount time). * Updates the `connected` state on success. */ reconnect: () => Promise; getBillingChoiceInfoAndroid: QueryField<'getBillingChoiceInfoAndroid'>; isBillingProgramAvailableAndroid: MutationField<'isBillingProgramAvailableAndroid'>; createBillingProgramReportingDetailsAndroid: MutationField<'createBillingProgramReportingDetailsAndroid'>; launchExternalLinkAndroid: MutationField<'launchExternalLinkAndroid'>; showBillingProgramInformationDialogAndroid: MutationField<'showBillingProgramInformationDialogAndroid'>; showInAppMessagesAndroid: MutationField<'showInAppMessagesAndroid'>; openRedeemOfferCode: MutationField<'openRedeemOfferCode'>; }; export interface UseIAPOptions { onPurchaseSuccess?: (purchase: Purchase) => void; /** * The app's flow from `createPurchaseFlow`, which confirms and finishes * every purchase. The hook recovers unfinished purchases once connected or * when the flow changes, reports outcomes, and refreshes ownership after * each. Leave finishing out of `onPurchaseSuccess` when this is set. */ purchaseFlow?: PurchaseFlow; /** Each purchase's outcome from `purchaseFlow`. */ onPurchaseFlowOutcome?: (outcome: PurchaseFlowOutcome) => void; onPurchaseError?: (error: PurchaseError) => void; /** * Options for the purchase success listener. iOS defaults to suppressing * StoreKit replay events for the same transaction ID; set * `dedupeTransactionIOS` to false only for diagnostics. */ purchaseUpdatedListenerOptions?: PurchaseUpdatedListenerOptions | null; /** * Called when a hook method such as fetchProducts, getAvailablePurchases, * getActiveSubscriptions or restorePurchases fails. */ onError?: (error: Error) => void; onPromotedProductIOS?: (product: Product) => void; onUserChoiceBillingAndroid?: (details: UserChoiceBillingDetails) => void; /** * Fires when the user selects developer-provided billing in an External * Payments or Google-rendered Billing Choice flow. */ onDeveloperProvidedBillingAndroid?: (details: DeveloperProvidedBillingDetailsAndroid) => void; /** Fires when a subscription enters a billing-issue state. */ onSubscriptionBillingIssue?: (purchase: Purchase) => void; /** * Enable a specific billing program for Android (8.2.0+). * Use 'external-payments' for Developer Provided Billing (Japan only, 8.3.0+). * Use 'user-choice-billing' for User Choice Billing (7.0+). * Use 'billing-choice' for Billing Choice (9.1.0+). */ enableBillingProgramAndroid?: BillingProgramAndroid; /** * Select who renders the Billing Choice screen (9.1.0+). Must match the * choiceScreenType returned by isBillingProgramAvailableAndroid. */ billingChoiceScreenTypeAndroid?: BillingChoiceScreenTypeAndroid; } /** * React Hook for managing In-App Purchases. Mounted hooks share one store * connection, which ends when the last of them unmounts. * See documentation at https://openiap.dev/docs/setup/expo#useIAP-hook */ export declare function useIAP(options?: UseIAPOptions): UseIap; export {}; //# sourceMappingURL=useIAP.d.ts.map