User's purchase success, but OnPurchaseFailed() is called

Our team receives this issue from some players.
Players purchase consumable product, but don’t get ProcessPurchase() called.
We test on some android devices and emulators,
it seems can be reproduced on some old version android environment.

Description
When user enable the google IAP interface, click BUY button, and click other interface space area quickly.
It will cause this order success, but OnPurchaseFailed() is called, and
return parameter is PurchaseFailureReason.UserCancelled.

Unity Version
2017.4.14f1

Unity IAP version
1.20.1

Platform and Store
Android GooglePlay IAP

1 Like

Would “other interface” be part of the same Unity game? So touching any other background object should also show this behavior?

Thanks for fast reply.
The “other interface space area” is google IAP interface.
I upload our game’s IAP screenshot.
If I click BUY button, and click the upper background area will close IAP interface.
I guess it could interrupt the purchase process, and cause player receives google’s receipt, but can’t get IAP item.

4040251--350659--Screenshot_2018-12-28-01-33-56-589_com.android.vending.jpg

If you click the BUY button, that dialog should go away. And the background in red in your screenshot is just your game, correct? The only “Goggle IAP Interface” is the Buy button. Do you mean click the Buy button, and then quickly click (touch) your game ?

The background is a part of Google IAP interface.
It seems like we can’t control this background’s behavior.

No, the background is not the Google IAP Interface. There looks to be a banner ad or your game interface, and a purple icon with a score on it at the very top. What does the text say?

I misunderstand the background :face_with_spiral_eyes:
The text is product name and description, purple icon is game currency.

@YujenDev At any rate, we will investigate.

@JeffDUnity3D
Thanks:)

Can you confirm that this happens on all Android versions, or just a subset?

Hi Jeff,
The deviceModel.txt is latest collected device information.
It’s seems can happen on any version.

4083892–356413–deviceModel.txt (905 Bytes)

Please provide a sample project that demonstrates the issue, or provides steps to reproduce with this sample project Sample IAP Project . I will do the same testing here.

Hi, I would like to add that we are also seeing this similar issue happening to a large number of users that write to us. On both Android and iOS, primarily Android.

Unity Version
2017.4.11f1

Unity IAP version
1.20.1

We see that some players charged for failed transaction. From the data of affected users, we see that they receive the ‘onPurchaseFailed’ event with ‘User Canceled’ failure reason, usually followed by many ‘Duplicate Transaction’ failure reasons.

My questions are

  1. There seems to be a bug with allegedly UserCanceled purchase getting through and charged, if Unity IAP thinks user canceled the purchase, the user should not get charged the transaction.

  2. When Unity IAP calls OnPurchaseFailed, besides the PurchaseFailureReason.ExistingPurchasePending failure reason, should we consider the purchase terminated right there? Is it safe to remove it from our own cache of pending purchases?

For 2, asking because we are also seeing that sometimes the supposedly ‘User Canceled’ transaction was actually a pending transaction that would be recovered on next app install (and Unity IAP initialization) therefore leading to a call of ‘ProcessPurchase’.

2 Likes

A purchase left in Pending would indeed trigger ProcessPurchase on next app launch. Are you able to reproduce? Please provide specific steps if so, with the sample project.

Thanks for getting back @JeffDUnity3D . Yes understood that a pending purchase would trigger ProcessPurchase on next app launch, my question is why would Unity IAP informed us that purchase was ‘failed with reason user canceled’ when in fact it was pending.

1 Like

@thingiebox Correct, that is the issue that we are investigating, and is currently not determined. Can you provide steps to reproduce in your situation?

@JeffDUnity3D based on our users’ descriptions and data we’ve seen, we have repro steps that have to do with attempting purchases under poor network connection.

Unity Version
2017.4.11f1

Unity IAP version
1.20.1

Android version
7.1.2 (probably not relevant)

  1. Initiate purchase on a consumable product, you will see native google play dialogue prompting you to tap to buy
  2. After hitting Buy button, immediately enable throttling of the network via Charles Proxy, make the throttling very very bad (e.g. something like single digit bandwidth, 40% reliability etc, can share my settings if needed), at this point, you should see the native purchasing dialogue spin like it is trying to process the purchase. This will go on for a good minute.
  3. You will eventually see a **Error. Connection timed out** message via the native dialogue. Hit ok' (that's the only option). At this point, in logcat you will see that the OnPurchaseFailed` event got fired with failureReason UserCanceled.
  4. Disable connection throttling, tap to buy the same product, you will get the **Error. You already own this item** message prompt in the google play native dialogue. Once you hit ‘ok’ on that, in the logs, you can see that, OnPurchaseFailed event got fired again with the reason **DuplicateTransaction**

The bug is that under this circumstance, user got charged but did not get the item. Restarting the app to reinitiate IAP did not see any pending transactions come through (and call ProcessPurchase) in the above repro.

We have inconsistent repro on iOS that sometimes such a failed transaction (under poor network) will actually be a pending transaction and inconsistently come through on next app init (as we see ProcessPurchase gets called) even though we use local receipt validation and always set PurchaseProcessingResult.Complete never pending.

2 Likes

@thingiebox I have reproduced using the exact same steps, thank you for providing. The IAP team mentioned that they have a fix ready for this issue, due out in the next release. No ETA, but told sometime this first quarter of 2019.

2 Likes

thank you @JeffDUnity3D for your fast response on this! much appreciated. :slight_smile:

Could you suggest any workaround until the fix is ready? Is there a way to deliver the user items he purchased despite Unity never fires ProcessPurchase? And how to unblock these items? One can not buy them again, getting “Already purchased” from google and “User cancelled” from Unity? Reinstalling app didn’t unblock these items. Thanks in advance for any advice on this problem.
Upd: if I refund those blocked tranasaction from GooglePlayConsole, the next time user starts app, Unity sends ProcessPurchase for those items as if they were bought and user receives the content. So I return money to the user and nevertheless he gets the content. But if I don’t do refund, the items are blocked forever and user gets nothing. Very strange Unity behavior