Skip to content

Risk of non-consumables being consumed unintentionally #3001

@appetizermonster

Description

@appetizermonster

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.

  1. Environment
    1. Platform:
    2. SDK version:
    3. OS version:
    4. Android Studio version:
    5. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions