This repository was archived by the owner on Aug 4, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -333,7 +333,15 @@ export function useIAP(options?: UseIapOptions): UseIap {
333333 [ ] ,
334334 ) ;
335335
336- // No local restorePurchases; use the top-level helper via returned API
336+ const restorePurchases = useCallback ( async ( ) : Promise < void > => {
337+ try {
338+ await restorePurchasesTopLevel ( ) ;
339+ await getAvailablePurchasesInternal ( ) ;
340+ } catch ( error ) {
341+ RnIapConsole . warn ( 'Failed to restore purchases:' , error ) ;
342+ invokeOnError ( error ) ;
343+ }
344+ } , [ getAvailablePurchasesInternal , invokeOnError ] ) ;
337345
338346 const validateReceipt = useCallback (
339347 async ( options : VerifyPurchaseProps ) : Promise < VerifyPurchaseResult > =>
@@ -506,15 +514,7 @@ export function useIAP(options?: UseIapOptions): UseIap {
506514 validateReceipt,
507515 verifyPurchase,
508516 verifyPurchaseWithProvider,
509- restorePurchases : async ( ) => {
510- try {
511- await restorePurchasesTopLevel ( ) ;
512- await getAvailablePurchasesInternal ( ) ;
513- } catch ( error ) {
514- RnIapConsole . warn ( 'Failed to restore purchases:' , error ) ;
515- invokeOnError ( error ) ;
516- }
517- } ,
517+ restorePurchases,
518518 getPromotedProductIOS,
519519 requestPurchaseOnPromotedProductIOS,
520520 getActiveSubscriptions : getActiveSubscriptionsInternal ,
You can’t perform that action at this time.
0 commit comments