how to check if a subscription has been canceled or terminated
how do i know if the subscription has been canceled or terminated? i didn't find this information in the documentation. all the logic of the subscription has already been done, from validation to recognition. to check the status of the subscription, do i have to have a backend or does the library provide something ready-made?
2 ways to do this, get current purchased items and check expire date, or have a backend that receives webhooks from app store/play store
The integration is flaky. On android, make a call to getAvailablePurchases, it will usually return one active subscription but the dates are for the original purchase, there is no information about renewal, so the purchase being there is indicative of an active subscription. Even if the subscription is cancelled, android will return the purchase until the period is expired. On iOS, the getAvailablePurchase could return a list of purchases, you need to find the latest subscription. Again when user cancel the subscription, it should go away. Unfortunately, they stick around for a very long time. making them very hard to test. so you do need a webhook to get the data correctly.
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.
Related doc is in https://hyochan.github.io/react-native-iap/docs/guides/subscription-validation