j3k0 / cordova-plugin-purchase

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

[ANDROID] product.finish() does'nt work and store is not ready after expired subscription #1218

Open Filavision opened 3 years ago

Filavision commented 3 years ago

system info

Cordova 10 Device: Samsung Galaxy A50 Android 11 Plugin Version: 10.6

Expected behavior

After an expired subscription the product should be available again.

Observed behavior

I have a Cordova App with a annual subscription. When i test the plugin it works well when i open the app every 30 minutes (life circle of a year test sub) and verify the receipt. I use my own receipt validation script (PHP). After 5 times renewing, the subscription ends and the product is available again. The receipt will not validate again by the plugin.

But when i forgot to open the app every 30 minutes, the plugin goes into a loop. For example: I purchase a test subscription and let the 5 life circles gone without opening the app. After 4 hours i open the app, the plugin recognised that the sub is expired but the product is not going to be available again. Every time I open the app, my receipt validation fires a callback(false, {code: store.PURCHASE_EXPIRED}) but the product is not chage it's state. I also tried to fire a callback(true, {}) or product.finish() and it also doesn't work.

ahmad-alk commented 2 years ago

hi @Filavision

did u find a solution for this?

gvorster commented 2 years ago

Using Android + cordova After window.store.order I notice that the approved event is fired. But when I do product.finish() inside the approved callback nothing happens and the owned status is never set.