RevenueCat/cordova-plugin-purchases

Unable to resubscribe after expiration in TestFlight/sandbox environment

Closed this issue · 10 comments

Describe the bug
This is an issue that appears to be being worked on in at least RevenueCat/purchases-unity and RevenueCat/purchases-flutter via these two bugs: RevenueCat/purchases-unity#144 and RevenueCat/purchases-flutter#449 - This same bug is happening with the cordova plugin. I just wanted to get it on the radar for the cordova plugin.

Basically when you first subscribe to a package everything works as expected but once it expires and you try to resubscribe it will not pop up the iOS App Store purchase dialog/action sheet for some users. After calling purchasePackage over and over again (seems to be the amount of times the previous subscription renewed) it will finally pop up again and work as expected. Trying to purchase a different package than the one that expired works without issue every time. I'm not sure what causes this behavior because it only happens after maybe 10% - 50% of expirations.

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

  1. Environment
    1. Platform: iOS
    2. SDK version: 2.4.0 (cordova-plugin-purchases)
    3. OS + version: 15.6.1
    4. XCode/Android Studio version: XCode, 13.4.1 (13F100) [Android isn't affected by this issue]
    5. Framework (Cordova, Ionic, Ionic Native, etc): @ionic/angular (Ionic), @awesome-cordova-plugins/purchases (Ionic Native), cordova-plugin-purchases
    6. Framework version: @ionic/angular v5.9.3, @awesome-cordova-plugins/purchases v5.45.0, cordova-plugin-purchases v2.4.0
    7. How widespread is the issue. Percentage of devices affected. Unknown, 10%-50% estimate
  2. Debug logs that reproduce the issue
    Let me know if you need this and I can get them, the other two bugs seem to point to it actually being a problem on Apple's end, and they are releasing an update that allows the RevenueCat SDK to use StoreKit 2 to see if it fixes the issue.
  3. Steps to reproduce, with a description of expected vs. actual behavior.
    Purchase an auto renewing subscription using the SDK. Once it expires try and purchase it again using the same Apple ID. About 10-50% of the time the iOS purchase popup won't appear. Instead the callback comes back as if it succeeded but with no active subscriptions and no errors/user cancelled process flags.

If you keep calling purchasePackage then eventually (after an amount of times that the previous subscription renewed) it will start working again. If you call purchasePackage and pass it a different package it'll work first time.
6. 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.

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

@jswilliams Hey 👋 Thanks for reaching out! That is very unexpected behavior but sandbox is also an environment than can experience some weird bugs 😔

We do have a release candidate of the new Cordova plugin 3.0.0-rc.8 which does add support StoreKit 2 and I'm hoping can fix this for you 😊 This is still a release candidate but it should be getting release soon™️

@jswilliams Turns out I mistaken and using StoreKit 2 might not be the a solution for this issue 😔 It seems like there is some delay on Apple's side that is causing this behavior which is why you aren't seeing it every time. There is no quick solution for this at the moment 😬 But updating to the release candidate and using StoreKit 2 could still help!

stale commented

This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Please reach out if you have additional information to help us investigate further!

@joshdholtz what will the eventual solution be for this? My understanding is that Apple uses TestFlight when reviewing new builds and I’ve heard of at least one user that was having Apple reject their updates because of this issue. My main worry is this might end up happening to us at some point and I’m not sure how we’d fix it to get it approved.

Even though we don’t see it happen every time, it still occasionally happens even after coming back a week+ after the last TestFlight subscription stopped renewing, so I’m wondering if the Apple TestFlight delay is actually in play here or not.

@jswilliams we're currently investigating the issue and might have a fix in place. It seems like transactions might be left unfinished, and in those cases creating a new transaction will make it go straight into "purchased" instead of going through the normal flow.
I'm reopening and will keep it open until we have a fix in place

Oops, forgot about the bot 😅

stale commented

This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Please reach out if you have additional information to help us investigate further!

Update here:

We've identified an issue on resubscribes where StoreKit will sometimes fail silently when attempting to finish a transaction. When attempting a new purchase of the same product, this will cause the iOS prompt not to show and StoreKit will report the transaction as successful.

We have issued a backend workaround that will ensure that on these occasions, the SDK will return an error and attempt to finish the transaction again. From this point on the user should be able to resubscribe to the product.

Appreciate you all getting a fix in!