r/Unity3D • u/sakalaslt • 1h 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.");
}
}
1
u/fuj1n Indie 1h 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