Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

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:
    13
    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

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,130
    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:
    13
    Thank you for the advice.
    I will try not to re-initialize purchase, and check new products with FetchAdditionalProducts().