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

how to check if a subscription has been canceled or terminated

Open thiagomachado1998 opened this issue 10 months ago • 2 comments

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?

thiagomachado1998 avatar Feb 20 '25 20:02 thiagomachado1998

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

erenkulaksiz avatar Apr 13 '25 22:04 erenkulaksiz

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.

muduolin avatar Apr 18 '25 02:04 muduolin

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

hyochan avatar Sep 30 '25 04:09 hyochan