Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 tasks done
Markario opened this issue Nov 1, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@Markario
Copy link

Markario commented Nov 1, 2023

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

    public void purchaseSubscriptionOption(final String productIdentifer,
    final String optionIdentifier,
    @Nullable final ReadableMap upgradeInfo,
    @Nullable final String discountTimestamp,
    @Nullable final ReadableMap googleInfo,
    @Nullable final String presentedOfferingIdentifier,
    final Promise promise) {
    String googleOldProductId = upgradeInfo != null && upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null;

  • purchaseSubscriptionOption typed with GoogleProductChangeInfo

    public static async purchaseSubscriptionOption(
    subscriptionOption: SubscriptionOption,
    googleProductChangeInfo?: GoogleProductChangeInfo,
    googleIsPersonalizedPrice?: boolean,
    ): Promise<MakePurchaseResult> {

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 Markario added the bug Something isn't working label Nov 1, 2023
@RCGitBot
Copy link
Contributor

RCGitBot commented Nov 1, 2023

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

@tonidero
Copy link
Contributor

tonidero commented Nov 2, 2023

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 added a commit that referenced this issue Nov 2, 2023
As reported in #763, we were using the `oldSKU` for google upgrades but
the typescript interface only accepts `oldProductIdentifier` in the
`purchaseSubscriptionOption` method. This makes sure all purchase
methods have the same logic. Note that `purchaseSubscriptionOption`
didn't exist before V5, but since some developers might have worked
around the issue by using `oldSKU`, I think it's better to support that
and avoid breaking their fixes.
@ColeTownsend
Copy link

ColeTownsend commented Jan 17, 2024

Also found this issue to break our android upgrade flow

@tonidero
Copy link
Contributor

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?

@ColeTownsend
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants