react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

getAvailablePurchases() method not working with auto-renewable subscriptions in iOS StoreKit 2 mode

Open nahlebn1k opened this issue 1 year ago • 7 comments

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description

Hello, i found out that getAvailablePurchases() method not working with auto-renewable subscriptions in iOS StoreKit 2 mode and returns empty array. I tried to debug swift native code with this method and found next error. productStore.getProduct() verification not working with auto-renewable subscriptions.

Expected Behavior

getAvailablePurchases() method should return array of current user subscriptions.

Screenshots

telegram-cloud-photo-size-2-5436003681662262592-y telegram-cloud-photo-size-2-5436003681662262596-y

Environment:

  • react-native-iap: 12.14.0
  • react-native: 0.74.1
  • Platforms (iOS, Android, emulator, simulator, device): iOS

To Reproduce Steps to reproduce the behavior:

Use getAvailablePurchases() method with active subscription in iOS StoreKit 2 mode


[Optional] Additional Context

nahlebn1k avatar Sep 20 '24 09:09 nahlebn1k

I discovered that getAvailablePurchases() on ios works, BUT only after fetching all products from App Store. I don't think that is approach is best in this case. Also Android works without fetching products.

nahlebn1k avatar Sep 20 '24 10:09 nahlebn1k

I have the same issue.

wallinex avatar Sep 26 '24 13:09 wallinex

I have the same issue. Did anyone got any solution to it?

mobilesmartdev avatar Nov 06 '24 05:11 mobilesmartdev

@mobilesmartdev In my current workaround i parse all existing in-app products and subscriptions with getSubscriptions() and getProducts() methods on the app launch. After this getAvailablePurchases() method works as expected.

nahlebn1k avatar Nov 06 '24 14:11 nahlebn1k

@mobilesmartdev In my current workaround i parse all existing in-app products and subscriptions with getSubscriptions() and getProducts() methods on the app launch. After this getAvailablePurchases() method works as expected.

True !

It's really a hidden obstacle, cost me a while

ngdbao avatar Nov 27 '24 10:11 ngdbao

same

cbjs avatar Jan 09 '25 07:01 cbjs

@mobilesmartdev In my current workaround, I parse all existing in-app products and subscriptions with getSubscriptions() and getProducts() methods on the app launch. After this, the getAvailablePurchases() method works as expected.

Yes, it really runs. Thank u

tieumainhi avatar Jun 06 '25 01:06 tieumainhi

I’m closing all issues reported in versions below 14, as the library now supports the new architecture with NitroModules and has been completely revamped.

hyochan avatar Sep 30 '25 18:09 hyochan