Search Unity

IAP ios no any callback "This In-App purchase has already been bought. It will be restore for free"

Discussion in 'Scripting' started by Martin_k, Feb 1, 2017.

  1. Martin_k

    Martin_k

    Joined:
    Feb 19, 2015
    Posts:
    6
    Hi,

    I have issue with "This In-App purchase has already been bought. It will be restore for free".

    steps to reproduce :
    - buy some consumable product
    - verify it, but not consume (with ConfirmPendingPurchase)
    - again try to buy the same product

    result :
    I have this message:
    "This In-App purchase has already been bought. It will be restore for free"
    and no any callback is called.

    This is problem, because I disable all buttons and don't have any callback to enable it.

    it is not related with addObserver.
    unity version 5.5.0p4

    Any ideas ?
     
    Wula, ikoukas and Shnayzr like this.
  2. Shnayzr

    Shnayzr

    Joined:
    Aug 31, 2014
    Posts:
    18
    same problem here.
     
  3. matt_icejam

    matt_icejam

    Joined:
    Apr 5, 2016
    Posts:
    2
    My understanding is that this is designed behaviour: the App Store won't allow a user to buy another consumable item until the first one has been "consumed" by your app. Unity seems to implement this consuming behaviour once a purchase is marked as Complete.

    The purchase is marked as Complete by either returning PurchaseProcessingResult.Complete from the ProcessPurchase method of your IStoreListener (for synchronous handling) or by registering the purchase as confirmed with the IStoreController with ConfirmPendingPurchase (for asynchronous handling of purchases that returned PurchaseProcessingResult.Pending from IStoreListener.ProcessPurchase).

    I still haven't implemented the handling of "restored" purchases and mark them as complete, but I think it has something to do with the Apple Store Extension triggering ProcessPurchase again on the next initialisation of the Purchasing module.
    https://docs.unity3d.com/Manual/UnityIAPiOSMAS.html
    https://docs.unity3d.com/ScriptReference/Purchasing.IExtensionProvider.GetExtension.html
     
  4. matt_icejam

    matt_icejam

    Joined:
    Apr 5, 2016
    Posts:
    2
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    As @matt_icejam said. If you don't consume it, you can't buy it again. The same thing happens on Android as well back when we tested it (don't think it's changed, but that was about a year ago). Unity has example code for their iap system and I believe it has a autoconsume part when the purchase is successful.

    Also, for future reference https://forum.unity3d.com/forums/unity-iap.112/ Unity has an IAP section to their forums.
     
  6. vivalavladislav

    vivalavladislav

    Joined:
    Sep 12, 2013
    Posts:
    16
    Any solutions in here?

    I have similar system of locking the interface, and the problem is I can't unlock it till I get a callback from the store. I'd expect to get a OnPurchaseFailed or any other callback to know that we can continue with a game flow.
     
    ikoukas likes this.
  7. ikoukas

    ikoukas

    Joined:
    Sep 17, 2015
    Posts:
    2

    It shouldn't be intentional cause the pending state is a legitimate state. It should call the OnPurchaseFailed method with one of the failure reasons while it calls nothing.
     
  8. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    I have the exact same issue.. Unity IAP people, can we get a callback for this event happening?
     
    hantengx likes this.
  9. hantengx

    hantengx

    Joined:
    Mar 13, 2017
    Posts:
    10
    I have the same problem.Finally, I made a repeat purchase test myself.

    1. Save the product before InitiatePurchase()
    2. ProcessPurchase() return Pending status, communicates with the server to verify (succeeds or fails), deletes the product
    3. Re-purchase, check the stored product, if repeated, then directly verify with the server.
     
  10. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    375
    I got this problem not how this fix this?
     
  11. ZzappSizzler

    ZzappSizzler

    Joined:
    Jan 15, 2017
    Posts:
    33
    I have spent FOUR days trying to fix this. I sure have learned a lot about IAP and tried many fixes in my scripts, but nothing worked. I discovered that on iOS Unity throws a NullReferenceException when it starts and receives the unfinished transaction. I was told by Unity that shouldn't be a problem, but IAP would not work, it would be stuck in the endless "This purchase has already been bought" loop. I tried new Sandbox testers, but, very soon, the problem would reappear. I uninstalled and reinstalled both 1.17 and 1.18 several times, but nothing worked.

    Finally, I installed a plugin - Easy Mobile Pro. It is so much simpler to implement, why on earth Unity IAP has to be so hard to get under the hood I don't know. Anyway, after a couple of hours changing my scripts, guess what? IAP on iOS is working! The plugin sits on top of Unity IAP, so why it works where the Unity Purchaser script didn't, I don't know. It sure simplifies putting IAP in my game. and IAP is now working, that's all I know. And you can access the scripts, no dlls.
     
  12. sameel

    sameel

    Joined:
    Dec 4, 2015
    Posts:
    17
    Hi hantengx, I am having this same problem. Can you please share you fix ?