Search Unity

Can I do UnityPurchasing.Initialize() more than one time without losing incomplete transactions?

Discussion in 'Unity IAP' started by yoppon, Dec 27, 2018.

  1. yoppon

    yoppon

    Joined:
    Nov 19, 2016
    Posts:
    17
    Can I do
    UnityPurchasing.Initialize()
    more than one time without any problems? If I do
    UnityPurchasing.Initialize() 
    more than one time, Will incomplete transactions be lost?

    I want to check shop item infos from my own server every time of launching app from background to foreground. And I want to do
    UnityPurchasing.Initialize()
    every time in order to reflect shop item product id changes.

    In this case, If I have not completed purchase transactions before hiding app to background, Will incomplete transactions be lost by
    UnityPurchasing.Initialize()
    ?

    If so, is there any other good way to refresh shop items without losing incomplete transactions, without any problems?

    (in iOS/Android)
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I would not recommend an approach like this, generally IAP initialization is done once, at app start. What incomplete transactions are you referring to? Can you elaborate "reflect shop item product id changes"? Once you sell an item to a user, you should not make any product id changes. But in general, no transactions should be lost. If they are left in Pending, they will show up in ProcessPurchase the next time the app launches (or IAP is re-intialized).
     
  3. yoppon

    yoppon

    Joined:
    Nov 19, 2016
    Posts:
    17
    Thank you for the advice.
    I will try not to re-initialize purchase, and check new products with FetchAdditionalProducts().