Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Missing CancelPendingPurchase ?

Discussion in 'Unity IAP' started by Spuddicus, Jul 17, 2019.

  1. Spuddicus

    Spuddicus

    Joined:
    Aug 11, 2014
    Posts:
    11
    I've just started implementing Unity IAP in my current game. I understand that when ProcessPurchase is called, I can either return PurchaseProcessingResult.Complete to complete the purchase immediately or return PurchaseProcessingResult.Pending if I want my server to validate the receipt or check for other forms of hacking. My question is this .... if my server finds that the receipt has been tampered with or maybe I want to cancel the purchase for some other reason, how do I do that ? I can call CompletePendingPurchase when my server has validated the receipt but there's no mention of what I should do if I want to cancel the pending purchase. Surely, I don't just leave the purchase pending forever? One other question .... once the purchase is pending, it sounds like ProcessPurchase will be called again the next time the App is restarted. This is very rare these days as most Apps go to sleep in the background. Will ProcessPurchase be called again when the App becomes active again or is it literally when it's restarted (which might not happen for a long time)? Maybe Unity should call ProcessPurchase every day while it's pending? Thanks!
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,865
    You can re-initialize IAP any time you want, which will trigger ProcessPurchase for any Pending purchases. If you detect fraud, you can return Complete but just not assign the IAP product to the user.