dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.81k stars 641 forks source link

How to get to information about subscription state on iOS (Storekit2 mode) ? #2530

Open cervebar opened 1 year ago

cervebar commented 1 year ago

Hi there, 👋🏻 I want to get informations about current status of iOS subscription, I found it can be done with Product.SubscriptionInfo.RenewalState which is also serialized here https://github.com/dooboolab-community/react-native-iap/blob/dad69b1f5a8792c144b04d4af7f7986ce945ddfc/ios/IapSerializationUtils.swift#L85.

But is it possible to get it somehow from react-native-iap code? Or how do you get such information? Only from BE?. In general sny tips&tricks about getting the auto-renewal subscription info (will expire, will be canceled) welcomed.

Environment:

bitfabrikken commented 1 year ago

I look at transaction.expirationDate in transactionListener. It's the unix epoch in milliseconds, so it's easy to see if it's still active.

Is that something that would work for you?