4

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?

The Flying Dutchman
  • 582
  • 2
  • 7
  • 18
  • Did you find the solution for this? I'm having this same problem and I'm using the latest version of the plugin and flutter. Getting no help on RCs github page. – Dpedrinha Jul 05 '21 at 20:21

3 Answers3

1

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.

aboedo
  • 141
  • 5
  • The problem is not getting operationAlreadyInProgressError. the call gets stuck with no error – Zahra Jamshidi Apr 09 '21 at 12:30
  • You should always try to set up the SDK as early as possible in your app flow. This is so that the SDK catches transactions in the queue as soon as they happen, which may include transactions happening outside of your app (like from the iOS setting menu). In addition, you should only ever need to call `setup` exactly once, there's no need to ever call it again. If a user logs out, you can use `reset` to reset the SDK to use a new anonymous ID, but you shouldn't call `setup` more than once in your app. – aboedo Apr 12 '21 at 15:04
  • As I explained below, there is a plugin conflict between AudioService and RevenueCat. Normally, e.g. in the sample app, everything works fine as you explained. But in my case after playing audio, RevenueCat calls got stuck. – Zahra Jamshidi Apr 13 '21 at 05:52
0

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.

Zahra Jamshidi
  • 681
  • 6
  • 9
0

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.

Zahra Jamshidi
  • 681
  • 6
  • 9
  • Do you mean we should call Purchases.setup() right before calling Purchases.purchasePackage()? I call Purchases.setup() on main() but the issue still exists – goodonion Dec 16 '20 at 11:18
  • If you are facing this plugin conflict, you need to re-setup Purchases before getting purchase info and getting offerings (most probably in initState method). – Zahra Jamshidi Dec 17 '20 at 12:18