Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Windows store promo codes not triggering ProcessPurchase on IAP initialization

Discussion in 'Unity IAP' started by delphinius81, Apr 25, 2018.

  1. delphinius81

    delphinius81

    Joined:
    Mar 6, 2012
    Posts:
    55
    Does Unity IAP support promo codes from the Windows store for MR devices? I have a hololens application that I was able to add IAP support when initiating a purchase from the application. Today I tried testing an IAP promo code for a non-consumable good, but Unity is not recognizing that the promo code was applied.

    Essentially, the ProcessPurchase callback is not being called for promo code purchases.

    In later testing, I purchased a different IAP product.from within the app, by calling the InitiatePurchase function. When I then restarted the application, ProcessPurchase was being called for the sku that I applied the promo code for, as well as the product purchased through the app itself.

    Deleting and reinstalling the application also allowed both purchases to be automatically retrieved.

    At a bit of a loss here for what might be going on.

    Using Unity 2017.1.3p1 with Unity IAP 1.18.
     
  2. nicholasr

    nicholasr

    Unity Technologies

    Joined:
    Aug 15, 2015
    Posts:
    117
    Thank you for the report! I believe I understand the problem - that promo purchases are seen only after a subsequent purchase is made.

    Calling extensions.GetExtension<IMicrosoftExtensions>().RestoreTransactions() after the promo has been purchased may generate the desired notification more prompty.
     
  3. delphinius81

    delphinius81

    Joined:
    Mar 6, 2012
    Posts:
    55
    Calling restore transactions does get ProcessPurchase to be called for the sku where a promo code was applied. However, this requires the user to leave our WMR application to load up the MS store where they are prompted to log in.

    Adding a restore purchases button with some warning about being directed outside of the application is ok as a workaround, but ideally I would not need to ask users to perform this extra step at all. Is there any way to have products entitled via promo codes to automatically be included?

    Should I file this as a bug report?
     
    nicholasr likes this.
  4. nicholasr

    nicholasr

    Unity Technologies

    Joined:
    Aug 15, 2015
    Posts:
    117
    Cool. Ok I understand the API pops another app and blows the immersion. A ticket would be helpful along with more information to help repro the issue and refine a recommendation / improvement.