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

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 ?

3 Likes

same problem here.

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/ScriptReference/Purchasing.IExtensionProvider.GetExtension.html

FYI here’s a link to the analogous behaviour in a native ios app App Store Sandbox is warning a con… | Apple Developer Forums
That’s the basis for my assuming it is designed behaviour.

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 Unity Services - Unity Discussions Unity has an IAP section to their forums.

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.

1 Like

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.

I have the exact same issue… Unity IAP people, can we get a callback for this event happening?

1 Like

I have the same problem.Finally, I made a repeat purchase test myself.

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

I got this problem not how this fix this?

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.

Hi hantengx, I am having this same problem. Can you please share you fix ?