JackAppDev / flutter_iap

Flutter iap plugin
MIT License
100 stars 15 forks source link

FlutterIap.fetchInventory() returns empty purchases #44

Open buttermilktoast opened 5 years ago

buttermilktoast commented 5 years ago

Hi there, I did see the other issue about this and it was resolved, but mine has been about a day already and it's still returning empty products. This is for Android on Google Play and I did purchase the IAP with this plugin and it worked so that was awesome!

Just trying to clarify if there is a missing set up step I needed to do to see my recently purchased IAPs... I did delete the app and reinstall it; wondering if that affects it? I do see the purchase in the Order History in my Account in the Play Store and have seen it come through in the Play console financial reports.

Any help is appreciated and thanks for making this plugin!

ened commented 5 years ago

Did you consume the purchase? If so, it will be gone from your inventory.

buttermilktoast commented 5 years ago

Does this only show non consumable in app purchases? Sorry, I thought it was a method to show your past purchase history. For context, it's an IAP to remove ads, and I wanted to basically remove ads if I see that you already purchased it.

As a side note, I'm unable to see how I can find out if my IAP is a consumable vs. a non consumable in the Google Play developer console. I did create this app a couple years back (recently converted to Flutter) so the interface has changed quite a bit... Do you perchance know how to tell?

ened commented 5 years ago

Past purchase history may not be available to App developers, I have yet to see the APIs for that. If there are any, we will integrate it into flutter_iap. For the AD removal usecase, simply don't consume it and check if the item is in the inventory.

Google Play IAPs are always consumable.

Apple IAPs can be created consumable and non-consumable, and are thus a little less "flexible".

buttermilktoast commented 5 years ago

Ahh ok I see, thanks. I come from the Apple world, so I'm more familiar with non-consumable vs. consumable aspect of it.

Regarding not consuming it, I can't seem to find out how to do that in the code. The way I've implemented the plugin is to just call the buy method with the id like so.

IAPResponse response = await FlutterIap.buy(removeAdsId);

Then I just check that the id is in the response and that's it. So I don't think I'm explicitly consuming it... Is there maybe another way to do the purchasing so that it's not consumed?

Thanks again for your time, it's really appreciated. Great job!

ened commented 5 years ago

@buttermilktoast the explicit consume is not available in this library, yet. The currently published version consumes all purchases immediately. @JackAppDev I will send the PR (which includes a few more changes.. protobuf, preparations for subscription logic) asap. We could release it as a 2.0.0-pre1