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

Store does not re initialized and purchases not acknowledged. #1433

Open mashrurbd opened 10 months ago

mashrurbd commented 10 months ago

When I close the store page, the Store does not re initialize on opening again and purchases are not acknowledged even after completing purchase via test cards.

esaugtz commented 3 months ago

I have the same error. Did you solve the problem?

Nikita0x commented 2 months ago

Bump for the issue. Has anybody fixed it or found a work around?

When component first mounts - store is initialized, products are loaded from google, I can subscribe for the test (but not acknowledge it). After 5 minutes, the product gets refunded.

But if I go to another page, and then go back to the page where initialization starts - it just fires the this.store.ready(() => { console.log('CDV PURCHASE PLUGIN IS READY'); }); but not registration (because it has been initialized already, it says). Is there a workaround for this or am I doing something wrong?

Nikita0x commented 2 months ago

@mashrurbd, @esaugtz - my team lead helped me understand the issue regarding re-initialization and it was disgustingly stupid. We are using Ionic + Vue. Even though we initialize the plugin in one component, it initializes globally due to inner workings. You can easily check it if you set it up in any component but the main App, launch the app and check the logs - you will see that Create CdvPurchase... (globally)...

Re-initialization won't work because it will be initialized once - all you have to do is to store the data it fetches from GooglePlay/AppleStore to storage, and then just use this data.

We have not understood how to solve the "not acknowledged" yet, though