Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Scripting Reference for In App Purchasing package nowhere to be found?

Discussion in 'Unity IAP' started by CanisLupus, Jul 26, 2019.

  1. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    257
    I was told (original post here) that the documentation pages moved to the Packages section of the docs and we are now supposed to open the Package Manager and use the documentation link for each package. OK. However...

    The In App Purchasing package seems to send us to:
    https://docs.unity3d.com/Packages/com.unity.purchasing@2.0/index.html
    Which redirects to:
    https://docs.unity3d.com/Manual/UnityIAP.html
    Which is a set of manual pages, so we still can't see the scripting reference.

    For example, searching for IStoreController here shows some pages in the results, but none for the scripting reference (although there are examples). If we want to see the documentation for a less used method like FetchAdditionalProducts, it's nowhere to be found (actually, we can't find the correct way to use this method anywhere, even on Google, but that's another problem).

    Where is the scripting reference? Thanks!

    Daniel
     
  2. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    257
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    I have let the documentation team know, but I have not heard back. If you have a specific question (other than where are the docs :) ) I would be happy to assist.
     
  4. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    257
    Thank you, Jeff. :) Actually, we have questions. How is FetchAdditionalProducts used exactly? The lastest docs we found are not clear enough, I think.

    FetchAdditionalProducts receives a HashSet of ProductDefinitions, in contrast with the normal initialization using Initialize, which receives IDs as strings and product types (through the Builder). Our understanding is that we need to construct the ProductDefinitions we want to fetch (since they don't exist yet) and send those to FetchAdditionalProducts. So we do something like this (simplified version):

    Code (CSharp):
    1. private void Initialize()
    2. {
    3.    ConfigurationBuilder builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    4.    builder.AddProduct(someId, ProductType.NonConsumable);
    5.    UnityPurchasing.Initialize(this, builder);
    6. }
    7.  
    8. private void RefreshProducts()
    9. {
    10.    var products = new HashSet<ProductDefinition>();
    11.    products.Add(new ProductDefinition(someOtherId, ProductType.NonConsumable));
    12.    storeController.FetchAdditionalProducts(products, null, null);
    13. }
    Would this be correct? We found other forum posts like this one that pass an empty HashSet, which seems....weird? But no one replied that it's wrong. It's also not the only post we found that did that, but I can't find the other(s).

    So, is our approach correct? Anything we should know?

    Cheers!
    Daniel
     
  5. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,197

    Yes, that approach looks correct.
     
    CanisLupus likes this.