Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Extending Unity Purchasing Subscription functionality on iOS

Discussion in 'Unity IAP' started by AakashDP, Jun 5, 2020.

  1. AakashDP

    AakashDP

    Joined:
    Nov 22, 2016
    Posts:
    21
    I am looking into getting Promotional Offers for subscription products through Unity Purchasing and I've found that this is currently not supported yet in Unity IAP.

    I was able to create a simple iOS plugin to get the discounts from an SKProduct and logically it works fine, however there are some ways it can be greatly improved with some help from the UnityPurchasing iOS plugin.

    In order to get the discounts for an SKProduct, I would need to request product data from Store Kit (just like the initiateProductPoll function in UnityPurchasing.m), but this can take quite some time or cause lag on lower end devices. Since calling UnityPurchasing.Initialize() on the C# side will do exactly the same thing and store the results in a dictionary in UnityPurchasing.m called validProducts, it would help a lot if on the Objective C side I could have access to the validProducts dictionary in UnityPurchasing.m to get the discounts on each product and send this to the game myself. This would also reduce the waiting time till I can display updated product information in game since all the necessary product data could be fetched by one request rather than 2.

    So the flow for getting discount information on a product would look like this:

    (C#) UnityPurchasing.Initialize() -> (C#) IStoreListener.OnInitialized -> (C# & Objective C) Custom logic to get discount information from custom plugin by checking the validProducts in UnityPurchasing.m

    This would be more like a middle solution (combination of C# and Objective C code) for getting product discount information until you guys add support for it through the Unity IAP plugin.

    Let me know what you think @JeffDUnity3D . Thanks in Advance!