-
Notifications
You must be signed in to change notification settings - Fork 97
Description
- I have updated Purchases SDK to the latest version
- I have read the Contribution Guidelines
- I have searched the Community
- I have read docs.revenuecat.com
- I have searched for existing Github issues
Describe the bug
I'm in the process of figuring out whether it's good to migrate my existing app, which has lifetime non-consumable products, to use RevenueCat.
I've seen a few issues related to RevenueCat consumed non-consumable products.
(#139, #2566)
So I looked into the SDK code, and I found that the RevenueCat SDK has some potentially disruptive behavior when migrating existing lifetime products. It might unintentionally consume non-consumables when a user launches a new version of the app that uses RevenueCat (via syncPendingPurchaseQueue, or when the user calls restorePurchases).
In PostReceiptHelper.kr, when the backend response is missing purchased_products or the product id doesn't match, shouldConsume defaults to true, causing any one-time product to be consumed.
I know the chance is low, but i don't think it's zero. For example, if the RevenueCat backend returns an incorrect response, such as missing the purchased_products key due to a backend or backend developer error, even when the product is configured as non-consumable in the RevenueCat dashboard.
Since consumption is irreversible, I think defaulting to false would be safer. I know this has been true for years, so changing it may not be trivial, but as a developer this still feels like a code smell.
- Environment
- Platform:
- SDK version:
- OS version:
- Android Studio version:
- How widespread is the issue. Percentage of devices affected.
- Debug logs that reproduce the issue
- Steps to reproduce, with a description of expected vs. actual behavior
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
Additional context