Search Unity

[Solved] IAP Init failed - No Products Available

Discussion in 'Unity IAP' started by Piflik, Apr 4, 2016.

Thread Status:
Not open for further replies.
  1. Piflik

    Piflik

    Joined:
    Sep 11, 2011
    Posts:
    293
    Is there a reason why IAP initialize fails if there are no products available, instead of simply doing nothing (or, even better, using the "availableToPurchase" flag to reflect this, which is already used for products that have been defined locally, but are not available online)?

    I try to replace Soomla with this native IAP system, but this is really annoying.

    (I know it would normaly be easily fixed by putting some debug-items into the store, but it is currently absolutely impossible to do so. That problem lies with us, not the platform, but it is currently not solveable)
     
  2. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Does this prohibit you from using functionality in some way?
     
  3. Piflik

    Piflik

    Joined:
    Sep 11, 2011
    Posts:
    293
    It's not completely prohibitive, I now just check if initialization failed before opening the shop and display a message instead, but it still was unexpected and I don't understand why it is like that, especially considering the 'availableToPurchase' flag in 'Products'. It is a strange reason for failing.

    (for example, no internet reachability, which to me seems like a more severe problem, is no reason for failing (which is convenient in case of a temporary connection drop) and not even worthy of a message or callback (which would be usefull), instead it just waits and neither OnInitialized nor OnInitializeFailed are called)
     
  4. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    If there are no products available for purchase then your App can't do anything with the store controller - there would be no point in Unity IAP initialising.

    This is a very common scenario in development; people rarely configure things correctly first time around. An explicit failure indicates to the developer that they need to take action to fix their setup.
     
  5. Piflik

    Piflik

    Joined:
    Sep 11, 2011
    Posts:
    293
    There is a point: Free Products. These are (apparently) not managed by the Google Play store (at least I didn't find an option to add free In-App 'purchases'), so they are never available online, a fact that I currently use to decide wether an item has do be bought or can just be unlocked (a dirty hack, I know, but it works), but I can't querry the IAP system, if the system is not running.

    (the usefulness of free 'purchases' is debatable in itself, though...probably the reason why they are not handled by Google Play...unlike iTunes...)
     
  6. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    iTunes lets you have free products? What happens when you try to buy them?
     
  7. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Recieving an error and letting storeController remain null, instead of initializing the storeController is for me VERY faulty logics. Why not let the user simply have zero products and notify the user about this "issue"/case instead. Currently it's not possible to test IAP-implementation without uploading an app on Google Play (because we can't even use the documented "android.test.purchased" product id to receive the native "fake" purchase-dialog).

    Not sure how it will be in Unity 5.4, but still. Having the storeController remain null without some kind of "state" seems to me like a bad design decision.
     
  8. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    If Unity IAP initialised in this scenario it would be giving you an IStoreController with no products to browse nor anything to purchase - ie. you wouldn't be able to do anything with it.

    IStoreController is not 'left null' - it is supplied when, and only when, IAP is ready. Applications need to handle the fact that this may take an extended period of time or may never happen.
     
  9. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    As I said, it would give me no products (fine! atleast i now get a Count of zero) but most of all I would be able to purchase prouducts using the "android.test.purchased" product-id (which I've tested and it works, but ONLY IF your app is published on Google Play). Handling no products as an "error" is just weird...That is no error, it's a "state". AFAIK you don't see Google handling it has an error, I believe they just give you an empty list of SKUs.
     
    Last edited: Apr 22, 2016
Thread Status:
Not open for further replies.