Search Unity

How does RestoreTransaction work on WSA

Discussion in 'Unity IAP' started by Foriero, Jun 10, 2018.

  1. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    IxxExtensions contains predominantly RestoreTransaction(callback) function signature BUT in WSA case we have only RestoreTransaction() without any callback. How do we know that the transaction was restored? Will normal Purchase event will fired? Or how does it work?

    Thank you, Marek.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What is WSA? Can you post a link to the documentation that you are referring to?
     
  3. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    Line Nr.3

    Code (CSharp):
    1.  if (Application.platform == RuntimePlatform.WSAPlayerX86 || Application.platform == RuntimePlatform.WSAPlayerX64 || Application.platform == RuntimePlatform.WSAPlayerARM)
    2.             {
    3.                 storeListener.m_MicrosoftExtensions?.RestoreTransactions();
    4.             }
    5.             else if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.tvOS)
    6.             {
    7.                 storeListener.m_AppleExtensions?.RestoreTransactions(storeListener.OnTransactionsRestored);
    8.             }
    9.             else if (Application.platform == RuntimePlatform.Android && purchaseModule.appStore == AppStore.SamsungApps)
    10.             {
    11.                 storeListener.m_SamsungExtensions?.RestoreTransactions(storeListener.OnTransactionsRestored);
    12.             }
    13.             else if (Application.platform == RuntimePlatform.Android && purchaseModule.appStore == AppStore.CloudMoolah)
    14.             {
    15.                 storeListener.m_MoolahExtensions?.RestoreTransactionID((restoreTransactionIDState) =>
    16.                     {
    17.                         storeListener.OnTransactionsRestored(
    18.                                 restoreTransactionIDState != RestoreTransactionIDState.RestoreFailed &&
    19.                                 restoreTransactionIDState != RestoreTransactionIDState.NotKnown);
    20.                     });
    21.             }
    22.             else
    23.             {
    24.                 Debug.LogWarning(Application.platform.ToString() + " is not a supported platform for the Codeless IAP restore button");
    25.             }
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    So for Windows Store Apps, you are asking how RestorePurchase works. I will check with the IAP team. Are you developing for mobile or PC ?
     
  5. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    Yes. It does not matter if mobile or pc. It is the same same api.
     
  6. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    Hi, so can anyone tell us how to get callback that the transaction was restored???

    storeListener.m_MicrosoftExtensions?.RestoreTransactions();

    There is no callback as passable parameter in IMicrosoftExtensions.RestoreTransactions?

    Is Unity playing no one use it so we don't care? I really don't see a viable way how to get restored callback.

    May be if this mechanism is not available in WSA Unity can state it in documentation?

    Thank you, Marek.
     
  7. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    Can PLEASE Unity write solid RestoreTransactions documentation for each platform. We can not write robust code if we don't have information how Unity handles Restoration on platforms like Google Play or WSA. There is literally none information about it. How should we handle Restoration in general. Please this needs to be improved we are now just guessing how it might work and compiling and testing which is not very convenient development.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Is ProcessPurchase not getting called during the restore operation for you?
     
  9. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    Jeff, please can anyone from Unity take a time and write down how each platform RestoreTransaction work? So that we don't have to use implementation method "try&error". Thank you, Marek.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  11. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    584
    Yes that is sad short description of how RestoreTransaction might work. Please be a bit more pedant and include each platform. So as I understand it is a bit different from platform to platform and we need to know the differences so that we don't have to use "try&error" method. Thank you, Marek.