Search code examples
in-app-purchasecodenameone

How to check in cn1 (in-app-purchase) if an app was purchased?


I have published a free app with ads on Google Play Store. I consider to implement in-app purchase (non-consumable product, ie. buy-once). So the app would be either free (restricted functionality) or full version depending whether the user has purchased it. After reading the relevant topics in the cn1 guide and some posts on the web, I still have some questions.

According to cn1-api-javadoc, the method Purchase.wasPurchased() returns true only "if the product was purchased (or has been restored) on the current device." I would like users to be able to use the purchased app on all their devices (including future devices), and on both platforms: Android & IOS. So I need a method like 'wasPurchased()', that returns true on all devices of users who purchased the app. How can this be accomplished? I would like to avoid using my own server for evidence about the purchases and clients.

I also consider, instead of implementing in-app purchase, to publish two separate versions: free version and full version as a 'paid app'. Is it correct that in this case the store (PlayStore or AppStore) will take care about the above problem (users will be able to download and use the full version on all their devices) ?

Thanks for your help.


Solution

  • For both platforms to work you MUST implement this on the server. There's no way around it since both OSs are different. I'm assuming you have a way to identify the user that works in an identical way across platforms. Once you enable that purchased flag in your backend database it should work across platforms regardless of the way in which the purchase was made.