Search Unity

[Solved] Restoring a purchase on Android

Discussion in 'Unity IAP' started by jonjojo, Dec 15, 2015.

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

    jonjojo

    Joined:
    Jul 29, 2014
    Posts:
    16
    I noticed a similar post about this but it didn't seem to answer my problem.

    In the docs it says; 'the ProcessPurchase method of your IStoreListener will be called for each owned item the first time Unity IAP is initialized.'

    But i'm not seeing ProcessPurchase being called on init.
    i'm seeing a "Already recorded transaction 14513513451345.1345134515151345" in the debug log but not sure where that's coming from.

    Is there something else i need to be setting up?

    Also, on Google Play you now have to consume a purchase, if its a consumable, when it's complete so does Unity IAP handle that now?

    Cheers
     
    Last edited: Dec 15, 2015
  2. jonjojo

    jonjojo

    Joined:
    Jul 29, 2014
    Posts:
    16
    I think we've fixed it if anyone else has a similar problem.
    Deleting the app off the phone/device and rebuilding/installing did the trick.
    I guess something must be getting cached.
     
  3. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    ProcessPurchase will only be called on the first launch following installation. If your App returns ProcessingResult.Complete then Unity IAP will not inform your app of those purchases again on subsequent initialisations, only for any purchases that completed whilst your app was offline that your app has not yet processed.

    Unity IAP automatically consumes consumable products on google play when your app confirms a purchase as processed. A purchase is considered processed when:

    Either:

    A result of ProcessingResult.Complete is returned from ProcessPurchase or by manual confirmation on IStoreController.ConfirmPendingPurchase(Product)

    Or

    If a result of ProcessingResult.Pending is returned from ProcessPurchase, when the app confirms the purchase as processed at a later confirmation on IStoreController.ConfirmPendingPurchase(Product)
     
    hippo_san and jonjojo like this.
  4. davinc131

    davinc131

    Joined:
    Jun 23, 2015
    Posts:
    19
    In version 3 api google for sales of products in applications, it supports only two types of products. Manageable products and signature products. Already Unity IAP has three products. Manageable, signature and consumables, and this has caused tremendous confusion in my head, because I see in posts around, it is necessary to consume the product after the purchase is completed. Some suggest the use of "m_Help.ConsumeAsync ()" method to do the job, but I have no IDEA how to implement it in a C # code. The version of my Unity is 5.3.3 and do not know if the new version of Unity supports this method. What needs to be exclarecido then, is how to simulate consumables in Unity IAP when Google Play supports only the signature products and manageable?
     
    Gilson401 likes this.
  5. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Unity IAP will consume products for you automatically.

    Declare all your products as 'managed' on google play, then declare them as 'Consumable' when you configure Unity IAP, which will then make the consumption call for you automatically.
     
  6. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    If the user has an internet problem when we return PurchaseProcessingResult.Complete, does Unity persist something that will still consume it later when connectivity is restored? We have some bugs reported by our QA right now where they are intermittently getting the "You already own this item" error from Google Play when trying to purchase consumables. *All* of our items are consumable, and the problem is intermittent, so it's not simply that we're failing to declare them as consumable or not returning PurchaseProcessingResult.Complete.
     
  7. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Unity IAP would attempt the consumption again on next initialisation or when receiving an 'already owned' response from making the purchase.

    Are you using the latest version of Unity IAP, 1.6.1? You can find your version in the Changelog.md file. Update to the latest by clicking 'import' in the In App Purchasing cloud service window.
     
    erika_d likes this.
  8. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Thanks for the reply @Banderous! We were on 1.5.0. I will try updating it now.
     
Thread Status:
Not open for further replies.