Hi Unity - The Unity IAP update 1.23.1 states:
“developers may choose to handle the PurchaseFailureReason.DuplicateTransaction for a ProductType.Consumable by rewarding the user with the product, and presuming that Unity IAP will automatically complete the transaction”
I was hoping someone could help explain this further to me? Should we reward the user in this situation or not?
Many thanks 
1 Like
@JeffDUnity3D
Please help me.
we should reward user when PurchaseFailureReason.DuplicateTransaction for a ProductType.Consumable.
Is this mean the Product info from OnPurchaseFailed would be with a valid receipt_?_
or how do i reproduce the issue about “GooglePlay - Fix offline purchases inconsistently generating OnPurchaseFailed callbacks”.
Thank you.
Have you checked the receipt? What issue are you trying to solve? You can attempt to reproduce by attempting to make purchases without the internet.
Thanks for your reply.
What i want to know is how to modify my code base on the update about “PurchaseFailureReason.DuplicateTransaction for a ProductType.Consumable”
my code is following this flow: (from IAP document)
You would want to catch this in OnPurchaseFailed. This is for an offline error condition. You can also reproduce by returning Pending from ProcessPurchase for a Consumable, and then attempt to purchase it again with the previous purchase still in Pending. The Sample IAP here allows you to test this Sample IAP Project
thanks a lot.
FYI, i have reproduced the DuplicateTransaction.
and i got the receipt in OnPurchaseFailed. but here is some questions base on the flow:
we reward user after step 7, and the step 9 not finish.
then user attempt to purchase again. then we got a DuplicateTransaction error with last receipt. we did’t need reward user. because we already reward user before.
so we need check the receipt is duplicate or not in OnPurchaseFailed, is this right?
or, am i misunderstand the “offline” ?
is this error only appear when use “Completing purchases immediately”?
How did you reproduce? Why did you “reward the user before” if the transaction didn’t finish?
Thanks for your patients.
- i have reproduced by : return Pending from ProcessPurchase for a Consumable, then before ConfirmPending, purchase the product again.
- actually, “reward user” happend in the server. after step 6.
what make me confused is the content in release note:
“developers may choose to handle the PurchaseFailureReason.DuplicateTransaction for a ProductType.Consumable by rewarding the user with the product, and presuming that Unity IAP will automatically complete the transaction”
if i follow the release note. i need reward user when get the DuplicateTransaction error, this is what i thought incorrect.
so i am confused.
It’s a rare occurrence and not something we have direct control over. So if you get DuplicateTransaction, you might consider awarding the user the product, to be safe.
Thanks for you information.
we will make more tests on this.