# Android Resore Purchase

**URL:** <https://forums.unrealengine.com/t/android-resore-purchase/486261>\
**Category:** Mobile\
**Tags:** onlinesubsystem, in-app-purchase, unreal-engine, Android, java, question\
**Created:** [July 15, 2021, 9:41pm UTC](https://forums.unrealengine.com/t/android-resore-purchase/486261 "2021-07-15T21:41:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![StAnger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StAnger](https://forums.unrealengine.com/u/StAnger)\
**Post date:** [July 15, 2021, 9:41pm UTC](https://forums.unrealengine.com/t/android-resore-purchase/486261/1 "2021-07-15T21:41:33Z")

</div>

In my game I have a single IAP that unlocks the full version of the game. The purchase itself works, all the information (price, currency, name, etc.) is displayed correctly. I was also able to make it non-consumable thanks to this post:

> [@Android letting me purchase a non-consumable product more than 1 time](https://forums.unrealengine.com/t/android-letting-me-purchase-a-non-consumable-product-more-than-1-time/225684):
>
> I’m using the following setup to make an in app purchase. I’m able to make the purchase in my app. I have a button setup. When i hit the button, google shows a test card and I’m able to make the purchase - No problem! However, after making the purchase when i hit the button again, Android does not say user already owns the item. I’m able to make another transaction. I’m setting the “is consumable” boolean value to false. How do I make/setup a non-consumable purchase that goes throug…

The only problem I have is that I am not able to check in any way whether the user already owns this IAP. I am aware that `Query for owned Purchases` and `Restore in-app Purchases2` do not work, and I gave up on fixing either after a few days of trying (most changes I make just crash the app on launch).

If the user attempts to purchase an item he already owns, this window pops up:

 ![344149-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/5/8a55e689352c04d8175869898784f934d58a9a16.png)

So I figured that I would be able to get this information from the purchase itself.  
in **Engine → Plugins → Online → Android → OnlineSubsytemGooglePlay → Source → Java → BillingApiV2 → com → EpicGames → ue4 → GooglePlayStoreHelper.java** there is even a response code for this case, `BillingResponseCode.ITEM_ALREADY_OWNED`. So, whenever there is a call to `nativePurchaseComplete()` I’m checking for this response code and calling `nativePurchaseComplete()` as if the purchase was successful. However, the blueprint node still returns `Failure` with an empty receipts structure.

**TLDR**  
If someone knows how to check for owned IAPs, please help me. I am losing my mind.  
If someone knows how to debug these java plugins (send any info from `GooglePlayStoreHelper.java` in any form, anywhere) that would also help a lot. Currently I am not able to debug it because the only time this file is actually used is when I upload my app to a closed test track AND it gets REVIEWED, so each update takes a while…

---

<div class="post-metadata">

**Author:** ![JohnBott9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JohnBott9](https://forums.unrealengine.com/u/JohnBott9)\
**Post date:** [July 18, 2021, 8:47pm UTC](https://forums.unrealengine.com/t/android-resore-purchase/486261/2 "2021-07-18T20:47:44Z")

</div>

Have you tried using queryPurchaseHistoryAsync()? According to [this](https://stackoverflow.com/questions/48457910/querypurchases-vs-querypurchasehistoryasync-in-order-to-restore-functional) thread only this function actually gets data from google.

---

<div class="post-metadata">

**Author:** ![StAnger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StAnger](https://forums.unrealengine.com/u/StAnger)\
**Post date:** [July 20, 2021, 2:23am UTC](https://forums.unrealengine.com/t/android-resore-purchase/486261/3 "2021-07-20T02:23:06Z")

</div>

Yes, that was one of the first things I’ve tried. Using this function crashes the app ☹

---

<div class="post-metadata">

**Author:** ![StAnger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StAnger](https://forums.unrealengine.com/u/StAnger)\
**Post date:** [July 22, 2021, 4:17pm UTC](https://forums.unrealengine.com/t/android-resore-purchase/486261/4 "2021-07-22T16:17:06Z")

</div>

Alright, I got the answer [here](https://forums.unrealengine.com/t/android-letting-me-purchase-a-non-consumable-product-more-than-1-time/225684).  
All credit goes to Arturogalaxy and Ashyankee
