Revenuecat, Flutter - PurchasePackage does not work, but there are no exceptions

Viewed 1001

Here is the scenario:

  1. Sandbox user bought a subscription and it expired.
  2. Sandbox user tries to buy that same subscription again.

Apple's IAP UX is not triggered, and the PurchaserInfo object comes back with out a new purchase and the new entitlement. There are no exceptions thrown.

Inside the Purchaser Info object, I see the old entitlements and expired subscriptions.

What am I missing here?

3 Answers

For the ones who're getting PurchasesErrorCode.operationAlreadyInProgressError:

There is a bug in purchases-flutter <= 1.2.1, that's been fixed in 1.3.0 and later. The bug itself is caused by a race condition and reproducible if you begin a purchase within the completion block of a previous purchase, for example if you have a retry mechanism in the error callback.

More details here: https://github.com/RevenueCat/purchases-ios/pull/313

The solution would be to upgrade, I'd recommend updating to the latest version available (currently 1.4.3).

If you're already using purchases-flutter >= 1.3.0, you should reach out to RevenueCat support at http://support.revenuecat.com so that they can help further.

I'm facing the same issue, for different scenarios. Sometimes the "purchasePackage" method succeeds, sometimes it doesn't return. no exception is thrown, the product's bottomsheet is not shown. If the purchase button is tapped again, I will get PurchasesErrorCode.operationAlreadyInProgressError. It's happening for sandbox and normal users.

In the logs I see purchase started, nothing more.

Finally, after a week of investigating the issue, I found the issue and a workaround: The problem is a conflict between AudioService and RevenueCat Purchase plugins. Calling "Purchases.setup" method in "initState" solved the issue.

Related