Search Unity

[Solved] Unity IAP: ExistingPurchasePending

Discussion in 'Unity IAP' started by farlenkov, Apr 3, 2016.

Thread Status:
Not open for further replies.
  1. farlenkov

    farlenkov

    Joined:
    Mar 28, 2014
    Posts:
    17
    I'm trying to integrate Unity IAP and it is breaks right away:

    1) I open my Android game and tap on "Buy X" (call IStoreController.InitiatePurchase("X"))
    2) Google Play's payment window pops up and I tap on big green "BUY" button on it
    3) Google Play's payment window prompts me to enter password from my Google-account
    4) I don't remember it, so I press Home button on my phone to close my game and find a text file with my password
    5) I copied my password from text file and return to my game
    6) Google Play's payment window is not there any more, so tap on "Buy X" again.

    What happens next? Nothing.
    I tap again and again, but that not help.
    Later in logs I see "PurchaseFailed" record with reason "ExistingPurchasePending".

    So it is looks like Unity keep that state like I'm in progress of purchasing, but I'm not, because Google Play's payment window is closed and I can't open it again. Full relaunch of the game helps, but most users may not come back to check this.

    What should I do?
     
  2. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    @farlenkov That description sounds like a bug which we are investigating. We have reproduced a similar inconsistency and have a fix under review. Expect to hear about a fix by next week.

    A bit more detail: Yes Unity IAP is keeping that state. The destruction of the Android Activity hierarchy when the user switches apps terminates the Google Play Purchasing Activity. IAP should track the termination more accurately as 'cancelled' - the state manager is currently unaware of the hierarchy being destroyed.
     
    erika_d likes this.
  3. rainer_klanggames

    rainer_klanggames

    Joined:
    Nov 12, 2015
    Posts:
    3
    This bug is still present in Unity 5.3.5p7.

    I get "ExistingPurchasePending" when trying to send a new purchase after minimizing the app during the previous purchase attempt.
     
  4. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @rainer_klanggames,

    What version of IAP are you on? This should have been fixed in the 1.5.0 release: see http://forum.unity3d.com/threads/unity-iap-package-1-6-0-is-now-available.415517/
    Can you try going to the Services window -> In-App Purchasing and clicking the Import button to update to the latest version of IAP?
     
  5. rainer_klanggames

    rainer_klanggames

    Joined:
    Nov 12, 2015
    Posts:
    3
    Hi Erika,

    I totally missed that and can confirm that this update solved the issue.
     
    erika_d likes this.
Thread Status:
Not open for further replies.