09-10-2012 03:28 PM
Hi, I've been trying to implement IAP in my game, and I seem to be having some problem with getting existing purchases. When the app starts (local mode) the paymentservice_get_existing_purchases_r
Is that how it is supposed to work in local mode? Is that how it is supposed to run when running online.
As stated in the documentation:
If true the device should be allowed to refresh the list of purchases from the Payment Service server, if false the current list of cached purchases should be returned immediately."
I guess what I'm asking is that is the allow_refresh parameter is turned off, then what does the function return exactly? Does that cache contain everything from the time that the app was installed or only from the current session?
Any help is appreciated.
Solved! Go to Solution.
09-12-2012 02:30 PM
Yes, this appears to be working as expected. Keep in mind that any purchases made that were not done with real money (in local or sandbox testing) will not constitute a transaction and therefore should not be expected to be returned with the paymentservice_get_existing_purchases_request() call.
As for the App World cache, the first time you run the app I would strongly recommend refreshing (pulling from the App World server) as the cache will be empty for this app. The cache will store some purchases but is never guaranteed to have the data available, so periodic refreshes are also recommended.
I hope that helps, if you have any further questions just let me know.
09-12-2012 02:38 PM
Hi, thank you for your reply.
I'm a little confused about the "The cache will store some purchases but is never guaranteed to have the data available" part. I understand that during the first run a refresh will be needed, but if the app has not been deleted, then can i assume that all the purchases that were available in the cache in the i-th run, will still be available in the cache in the (i+1) th run?
09-12-2012 03:15 PM
The App World cache is like your browser cache, it's nice to use when available but should not be relied upon. The cache can be cleared at any time, for example if the device ever gets low on memory.
Your application should keep track of purchases, there shouldn't be a need to check for purchases every time it is run but you can use the cache for quick checks, if info is available then your app could use it (ex after a re-install of the app) otherwise it would likely be best to refresh and also cache all purchases in your app as well.