Assume a regular case of buying the consumable item with server side validation. User went through a store purchase, got money charged and now it’s our turn to issue a product. We freeze the transaction by PurchaseProcessingResult.Pending and send our servers a request to validate the transaction. In case the server fails to validate(any reason) - it’s on hold.
Okay, so when in this case player tries to buy the same product we face different API issues:
Google Play - OnPurchaseFailed is called with DuplicateTransaction reason and we have control over code execution
App Store - user is prompted with Apple Store UI with “This In-App purchase has already been bought. It will be restored for free”, and nothing gets called in IStoreListener code
This is the problem for us, because we lock the game interface till we get any callback from a store.
So, is it an expected behaviour or a bug? If it’s expected - do you have any suggestion how should we change the flow to deal with different stores in same way?
If the server fails to validate, the preferred action would be to complete the transaction. This does not mean the transaction was successful, only that the purchasing system no longer needs to be notified about that transaction. This should free up the Purchasing system if the user wants to make another purchase.
This sounds correct in the case where the transaction is still Pending.
I think that message should only show up for a Non-Consumble, so that might be a bug. How are your products defined in the iTunes Connect and your IAP catalog in your app?
This message is shown for a consumable too, we have only consumables in Connect.
I’ve made an example project from IAP demo, which reproduces the issue.
Description of your issue
ios App Store: after buying already pending consumable product OnPurhcaseFailed is not called in IStoreListener when returning to the game
Your purchasing script - See attached project “ios iap no callback.zip”
Device logs - See “ios log.txt”
Unity Version - Unity 2017.1.0p2
Unity IAP version -
1.14.0 - 2017-09-18*
Platform you are building for - iOS
Store you are targeting - App Store
STR
Change correct product id in IAPDemo.cs
builder.AddProduct(“YOUR CONSUMABLE IN HERE”, ProductType.Consumable);
Launch the app on any iOS device
Tap buy
Complete App Store buying process => the item haven’t been processed yet on purpose
Tap buy again
Confirm the purchase
Get a App Store Message “This In-App purchase has already been bought…”