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

purchaseSubscriptionOption uses incorrect/old UpgradeInfo.oldSKU field and fails to upgrade Android subscription

Open Markario opened this issue 1 year ago • 5 comments

Describe the bug Calling purchaseSubscriptionOption with a GoogleProductChangeInfo argument fails to upgrade a subscription (adds a new subscription instead). The issue is that the implementation in the Android RNPurchasesModule uses the oldSKU field from the old UpgradeInfo instead of the typed oldProductIdentifier in GoogleProductChangeInfo. As a workaround I added oldSKU to the googleProductChangeInfo argument as well.

  • purchaseSubscriptionOption implementation that checks for oldSKU instead of oldProductIdentifier https://github.com/RevenueCat/react-native-purchases/blob/93ef699450e8b6a53aa4b42b95a49b1d10685527/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java#L209-L216

  • purchaseSubscriptionOption typed with GoogleProductChangeInfo https://github.com/RevenueCat/react-native-purchases/blob/93ef699450e8b6a53aa4b42b95a49b1d10685527/src/purchases.ts#L476-L480

Same issue in the community https://community.revenuecat.com/sdks-51/reactnative-sdk-purchasesubscriptionoption-not-applying-proration-and-oldproductidentifier-3520

  1. Environment
    1. Platform: Android
    2. SDK version: 7.2.0
    3. OS version:
    4. Xcode/Android Studio version:
    5. React Native version:
    6. SDK installation (CocoaPods + version or manual):
    7. 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 Add any other context about the problem here.

Markario avatar Nov 01 '23 21:11 Markario

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Nov 01 '23 21:11 RCGitBot

Thanks for reporting and debugging @Markario. You're correct, that method is incorrectly parsing the old product identifier. We will release a fix for this issue soon.

tonidero avatar Nov 02 '23 08:11 tonidero

Also found this issue to break our android upgrade flow

ColeTownsend avatar Jan 17 '24 01:01 ColeTownsend

Sorry we forgot to update the issue here. A fix for this was released in 7.3.0. Please let us know if that solved your issue @Markario.

@ColeTownsend could you confirm what version you're using to confirm it's not the same error?

tonidero avatar Jan 17 '24 08:01 tonidero

We are using 7.5.1, we had to change what values we were sending in the makePurchase function to include the new GoogleProductChange value in addition to the deprecated UpgradeInfo.

Wasn't sure if this was fixed/closed

ColeTownsend avatar Jan 17 '24 15:01 ColeTownsend