Why is this IAP code not working.

0 favourites
  • 7 posts
From the Asset Store
a ready made template of Mobile Advert, Google Play and Mobile IAP Plugin,
  • On startup I do an isStoreAvailable>>requestStoreListing. And then run this code:

    and hasProduct keeps coming back false even though the product was purchased. The purchase product part of my code worked perfect and the Google Play transaction is showing it purchased. I've checked the spelling and case of the 'fullversion' numerous times, it is correct.

    What I'm trying to accomplish is to first check to see if the app is paid for by checking against the store and if that fails and the user is offline, it falls back to a stored setting. ButtonCount is a dictionary entry that records whether the product is purchased or not and saves it to local storage. When it's loaded, it sets the global DemoVersion to 1 or 0 based on 'ButtonCount' if the store is unavailable.

    DebugDict is so I can figure out what it's doing.

    Also, what does 'restorePurchases' do? It's not explained terribly well in the manual.

  • I guess I've asked too many questions or they're getting too difficult. I can't seem to get an answer any more.

  • Pretty sad when you spend 3 weeks trying to get IAP working on a finished project and still can't.

  • IAP conditions

    Has product

    "Test if a given product ID has been successfully purchased by the user. Note that in some cases this will be false for the first few seconds of the app running even if the user has purchased the item, and then later become true when the store finishes loading the store status in the background. Try to avoid using this condition before On store listing success triggers."

    You could try changing the way that's triggered.

    The browser object has an is online condition, not sure if it will work in a non browser setting though.

    Also restore purchases is for when an app gets deleted, and reinstalled.

    If you think you found a bug, make a simplified capx, and submit it to bugs.

  • Finally, someone looked and can't find anything wrong. Thanks newt

    I know that it's getting the store listing. This is in a 'loader' layout. It won't even switch to the next layout (which it it doing) until one of these conditions are true. I even know that it's finding the product as the ProductName('fullversion') comes back with the appropriate product name. And yes, I learned about the restorePurchases. It's doing that now. And I know it's realizing the product is purchased because I'm getting a 'purchase failed' error from the IAP if I try to purchase it again.

    I just wanted someone else to confirm that this code looked good before I went to the headache of tracking down a bug that isn't one I created. Everyone else seems to think that the IAP is working fine yet I'm completely stuck.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Using triggers as sub events to other triggers is always iffy imo.

    I would suggest using variables like:

    on store listing success, set variable.success to 1

    store variable.success =1

    has product version, set variable.success to 0

  • I would but, the available menu items are based on whether it's purchased or not.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)