Hello!
I’m trying to query Google for IAP the user already purchased and no matter what I do, I don’t get a correct reply
This: (Full image on Imgur)
Is the code I’m currently using. I made sure that I’ve bought an IAP and I want to check if I can tell I did at startup.
This is the relevant part of the log I’m getting:
[2021.11.03-14.16.00:185][271]LogBlueprintUserMessages: [BP_GameMode_Gameplay_C_2147482563] Trying to QUERY FOR OWNED PURCHASES
[2021.11.03-14.16.00:214][271]LogOnlinePurchase: OSS: FOnlinePurchaseGooglePlay::OnQueryExistingPurchasesComplete Response: Ok Num: 1
[2021.11.03-14.16.00:214][271]LogOnlinePurchase: OSS: Adding existing receipt OfferId: basketball_game_product_no_ads TransactionId: [LONG ALPHANUMERIC CODE] ReceiptData: {
"receiptData": "[LONG ALPHANUMERIC CODE]",
"signature": "[LONG ALPHANUMERIC CODE]"
}
[2021.11.03-14.16.00:214][271]LogBlueprintUserMessages: [BP_GameMode_Gameplay_C_2147482563] Query form Owned Purchases returned: *Failure* Purchase Status Enum = 'Failed'
[2021.11.03-14.16.00:223][272]LogBlueprintUserMessages: [BP_GameMode_Gameplay_C_2147482563] Query form Owned Purchases returned: *Success* Purchase Status Enum = 'Purchased'
[2021.11.03-14.16.00:224][272]LogBlueprintUserMessages: [BP_GameMode_Gameplay_C_2147482563] Query form Owned Purchases Return an **EMPTY ARRAY**
As you can see, the log starts with printing the message that the event is triggered, it’s this part of the BP:
Then, the internal log of the OnlineSystems says it actually managed to find an IAP the user purchased with this line FOnlinePurchaseGooglePlay::OnQueryExistingPurchasesComplete Response: Ok Num: 1
However then both the On Success
and On Failure
branches of the node trigger:
And the the success branch confirms that the retrieved array is empty:
This confuses me, it’s clear in the log that it sees the IAP after the query. Why am I getting an empty array as a result?
Also, it’s clearly wrong that both ‘OnSuccess’ and ‘OnFailure’ branches trigger, is it not?
I saw this post Android letting me purchase a non-consumable product more than 1 time - #4 by Ashyankee by @Ashyankee from this question and added his confirmation code to my GooglePlayStoreHelper.java
However as you see, I’m still getting an empty array. Does anyone know how to resolve this issue?
Also, on the above mentioned post, another user @Arturogalaxy suggests a workaround that involves further edits to the GooglePlayStoreHelper.java
file. He suggests to inject a string that says ‘owned’ into the Read In App Purchase Information2
node.
My question is this, if the java file knows what IAP are owned then why is this hack necessary? If the Java file knows the user made an IAP, why this information isn’t passed on to the node’s output?