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

Will ProcessPurchase be called again if app crashes?

Discussion in 'Unity IAP' started by jmakar, Jul 9, 2018.

  1. jmakar

    jmakar

    Joined:
    Jun 27, 2018
    Posts:
    18
    Hi - I'm designing our app's IAP system and looking to harden the payment flow across all edges. We do fulfill the purchase on our server, therefore we need to return PENDING when ProcessPurchase is called. However, since it is possible that our server may not be reachable at that moment I'll need to cache locally enough information to resume this flow later, even in a later session.

    I intend to cached from within ProcessPurchase but before the return statement (obviously). But what if the act of caching causes a crash and so no PurchaseProcessingResult is returned at all. Will ProcessPurchase() be called again in the next session?
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Yes. ProcessPurchase will get called again as long as the transaction could not be completed.
     
    jmakar likes this.
  3. jmakar

    jmakar

    Joined:
    Jun 27, 2018
    Posts:
    18
    Thanks Baroni. If I successfully return PENDING, will I also receive more ProcessPurchase calls in future sessions until I eventually return COMPLETE or manually complete it?

    Note: I went to refer to the documentation again but some of it is unavailable this morning. I assume it is somehow related to the 2018.2 release. (Example 404: https://docs.unity3d.com/ScriptReference/Purchasing.IStoreListener.html)
     
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    That is correct.

    Thanks for reporting this. I'll look into this.