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

Caching Expire Date from Validation #560

Closed aesculus closed 7 years ago

aesculus commented 7 years ago

Is there a way to cache the expire date for subscriptions? On my back end validation I can capture it and even send it back on the verify transaction. I can see it appear on the logs but I have no way to use or capture this using the plugin.

I would like this so I can avoid validating the obvious (ex: 1 month into a 12 month subscription). It's a waste of cycles and bandwidth I would like to eliminate in my app. While I could capture the original purchase date and store that on the users device, without the server I cannot update when the subscription has renewed. If I could capture the expire date on the return of the validation then I would just cache that on the users device and bypass the checking altogether until the subscription date passed. Note I would also need to do this during restore too so I really need the ability to capture the data from the server.

centrual commented 7 years ago

It's automatically caching. You don't need to think about that.

aesculus commented 7 years ago

It does not cache the auto subscriptions. Those have to be validated with Apple or Google.

centrual commented 7 years ago

http://stackoverflow.com/questions/26557612/what-does-local-caching-for-android-in-app-billing-do

Your transaction datas caching in phone memory. When you use restore command, it's coming from phone's memory.

Also, if you asking validated receipt, it's about your mechanism. You need to restore products and send to your server for check.

aesculus commented 7 years ago

Only the Apple or Android server can validate the status of subscriptions because they can be canceled or not renewed. Your local or server cache only shows you the state when the transaction occured. And if it was auto renewed, you have no visibility of that unless you check with the two stores.

centrual commented 7 years ago

I think i didn't understand your issue. Whatever, it seems you the answer already.

Have a great day.

Dexus commented 7 years ago

The best way is doing it your own way caching... and use a own validator where you can use your cache. Please look at the source and api documentation.