IAP query not working - V2, Android (ue5.1)

Hi, I struggle to make IAP work on the android platform. To be specific, purchase is working but the query is not. I believe all is configured properly because as I said - purchase is working.

I’m utilizing V2 path and this is specified also in the AndroidEngine.ini

[OnlineSubsystemGooglePlay.Store]
bSupportsInAppPurchasing=true
bUseStoreV2=True

Making query however, leads to this log messages

UInAppPurchaseQueryCallbackProxy2::TriggerQuery - GetUniqueNetIdFromCachedControllerId
UInAppPurchaseQueryCallbackProxy2::TriggerQuery - Invalid UniqueNetId
UInAppPurchaseQueryCallbackProxy2::TriggerQuery - Failed to even submit

As for the BP part, I’m using this method.
Screenshot 2023-03-23 at 09.26.25

As you can see, I’m passing PlayerController, but the process fails here:

FUniqueNetIdRepl QueryingPlayer = PlayerController->GetLocalPlayer()->GetUniqueNetIdFromCachedControllerId();

if (QueryingPlayer.IsValid())
{
 
FFrame::KismetExecutionMessage(TEXT("UInAppPurchaseQueryCallbackProxy2::TriggerQuery - Querying Store Interface"), ELogVerbosity::Warning);
bFailedToEvenSubmit = false;
StoreInterface->QueryOffersById(*QueryingPlayer, ProductIdentifiers, FOnQueryOnlineStoreOffersComplete::CreateUObject(this, &UInAppPurchaseQueryCallbackProxy2::OnInAppPurchaseRead));
}
else
{
					FFrame::KismetExecutionMessage(TEXT("UInAppPurchaseQueryCallbackProxy2::TriggerQuery - Invalid UniqueNetId"), ELogVerbosity::Warning);
}
				}

meaning QueryingPlayer.IsValid() is false. I checked for the GetLocalPlayer() too but it is valid. Any ideas why this can be?

Fun fact - query and purchase works with the same code without problems on iOS

I will appreciate any ideas, what else to try, or feedback you struggle/or it works for you.

3 Likes

Hi, did you find a solution to this?

I’m seeing the same issue with UE 5.3.1, except it’s happening on iOS. The IsValid() call is returning false when attempting an In-App Purchase.

Same here, we are getting ‘Invalid UniqueNetId’ when trying to read or make IAP on IOS.