[Closed] Different behaviour when trying to buy pending item on Google Play and App Store

Hello guys,

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?

Hope to hear as soon as possible,
Vlad

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?

If you could provide the details requested here, we could look into this further:
https://discussions.unity.com/t/651693

Hi again,

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

  1. Change correct product id in IAPDemo.cs
    builder.AddProduct(“YOUR CONSUMABLE IN HERE”, ProductType.Consumable);
  2. Launch the app on any iOS device
  3. Tap buy
  4. Complete App Store buying process => the item haven’t been processed yet on purpose
  5. Tap buy again
  6. Confirm the purchase
  7. Get a App Store Message “This In-App purchase has already been bought…”
  8. Tap ok
  9. no callback in IStoreListener is called

Hope to hear from you soon!

3243904–249436–ios iap no callback.zip (1.94 MB)
3243904–249437–ios log.txt (65 KB)
3243904–249437–ios log.txt (65 KB)
3243904–249436–ios iap no callback.zip (1.94 MB)

@vivalavladislav

Thank you for that information. We are investigating this issue.

You can track the progress in the Issue Tracker:
https://issuetracker.unity3d.com/product/unity/issues/guid/952990/

@ap-unity thanks, waiting for a resolution