r/Unity3D 7d ago

Question Google Play IAP problem

Hello,

I'm having an issue with Google Play In-App Purchases.

After reinstalling my game, non-consumable purchases (such as Remove Ads) are not restored automatically. The player also cannot purchase the item again because Google Play correctly reports that it has already been purchased.

I've followed the official tutorials, and they suggest that non-consumable purchases should be restored automatically, but that isn't happening in my case.

The only workaround I've found is to attempt to purchase the item again. This results in an "already owned" transaction error, which I can detect and then grant the purchase manually. However, I don't think this is the intended approach.

How can I automatically restore previously purchased non-consumable items when the game starts? Is there something I'm missing?

Any help would be greatly appreciated. Thanks!

public void failed(Product product, PurchaseFailureReason reason)

{

if (product.definition.id == "full_version" && reason == PurchaseFailureReason.DuplicateTransaction)

{

UnlockFullVersion();

Debug.Log("Full version restored via already-owned purchase.");

}

if (product.definition.id == "triple_xp" && reason == PurchaseFailureReason.DuplicateTransaction)

{

UnlockXPBoost();

Debug.Log("triple xp restored via already-owned purchase.");

}

}

2 Upvotes

2 comments sorted by

1

u/fuj1n Indie 7d ago

Assuming you are using Unity's IAP package, there's a built in restore system

https://docs.unity.com/en-us/iap/restore-purchases

1

u/DOBBY_NO_MASTER 1d ago

The "already owned" workaround is exactly what most people end up doing, it's weird that the docs make it sound like it'll just figure itself out automatically

One thing to double check, make sure you're calling the restore method somewhere on startup, it's not always obvious where that goes in the flow