j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

Detecting invalid products does not work in v13 #1497

Open alexp25 opened 6 months ago

alexp25 commented 6 months ago

Observed behavior

The new version of this plugin does not detect invalid products (e.g., not available/deactivated products, etc.) Previously, there used to be an event store.when().invalid and now there is only store.when().valid

How is it possible now to detect invalid products while loading their details from the store? It seems store.get(pid) returns undefined until the products have been loaded, but that would imply waiting for the invalid products forever.

Expected behavior

There should be an event triggered for invalid products too, or some way to skip waiting for them to load.

undergroundcreative commented 6 months ago

I'm not sure if this helps, but if you look in the migration guide, it says "In the new version, only valid products are included in store.products...":

https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO:-Migrate-to-v13#detecting-valid-products

alexp25 commented 6 months ago

That's exactly my point - now there seems to be no way to check the valid products until they are loaded from the store, but how can I wait for the valid products to load without waiting forever for the invalid products?

undergroundcreative commented 6 months ago

My understanding is that it doesn't load invalid products at all - only valid products. So you shouldn't need to worry about waiting for invalid products to load.

alexp25 commented 6 months ago

Yes but how do I know they are invalid if they don't load at all? I should wait for them to load eventually, right? But now if they are invalid..

undergroundcreative commented 6 months ago

I guess you'd log out the ones that do load and see if there are any missing..