"Read In App Purchase Information2" doesn't work without logging into Google Play Games

Hi, I’m making an android game with in-game purchases. I’ve noticed that “Read In App Purchase Information2” only works when logged in to Google Play Games. I note that it’s about v2. Previously, v1 worked without this app. Is this normal for In-app purchases v2? Has anything changed? I’m working on UE 4.27.1.

352414-screenshot.png

I’m currently working through these issues with 4.27.1 built from github code and will share what I have found. I will update as I make progress.

The code for this node checks for the validity of the unique net id. In my game the player is actually logged in with a valid response, and it still fails the IsValid() check. (problem with UE4 code? Not sure)

I noticed the google version of the query function call StoreInterface->QueryOffersById(…) doesn’t even use the ID. It may just be included for other platforms.

So I tested commenting the ID check out entirely, and the node worked. See UInAppPurchaseQueryCallbackProxy2::TriggerQuery in Engine\Plugins\Online\OnlineSubsystemUtils\Source\OnlineSubsystemUtils\Private\InAppPurchaseQueryCallbackProxy2.cpp)

Obviously this isn’t a good solution and may have consequences Im not seeing yet. Also puzzled as to why the ID is invalid when the user is 100% logged in (in my case)

Hi Beastman! Thanks for the answer. I would like to try your solution but I must admit that I am not very knowledgeable about C++. Could you give me a hint which part of the code exactly you excluded?

You can see the commented out code here. Like I said, it’s not an ideal solution at all, and doesn’t consider other platforms. I still am not sure why even when logged in the ID was invalid here but since commenting out worked I didn’t investigate much further.

Also, note that you have to build the engine from github code to make a change like this. It’s not something you can do with the normal engine installed from the launcher.

Ok, thank you!

In unreal engine 5.1 (maybe it’s the same with 4.27), we can fix this by changing GetUniqueNetIdFromCachedControllerId() at line 41 by GetUniqueNetIdForPlatformUser(), because … GetUniqueNetIdFromCachedControllerId is deprecated :slight_smile:

This didn’t work for me on UE4.27 Source Code. Read In App Purchase Information2 still fails

The Engine doesn’t build after these changes (UE4.27 Source)