cordova-plugin-purchase icon indicating copy to clipboard operation
cordova-plugin-purchase copied to clipboard

Detecting invalid products does not work in v13

Open alexp25 opened this issue 2 years ago • 5 comments
trafficstars

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.

alexp25 avatar Nov 14 '23 08:11 alexp25

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

undergroundcreative avatar Nov 14 '23 12:11 undergroundcreative

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?

alexp25 avatar Nov 14 '23 13:11 alexp25

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.

undergroundcreative avatar Nov 14 '23 14:11 undergroundcreative

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..

alexp25 avatar Nov 14 '23 14:11 alexp25

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

undergroundcreative avatar Nov 14 '23 15:11 undergroundcreative