I fixed this finally. Problem lies within the engine itself. According to Google, all purchases need to be “acknowledged” after the successful purchase event. I checked the GooglePlayStoreHelper.java file at Engine → Plugins → Online → Android → OnlineSubsytemGooglePlay → Source → Java → BillingApiV2 → com → EpicGames → ue4 → GooglePlayStoreHelper.java.
Check the OnPurchaseResult method. There is no code for acknowledgement. In fact without acknowledgement, Google play will refund the purchase within a week. So make sure you add this code before the line that says…
nativePurchaseComplete(BillingClient.BillingResponseCode.OK, sku, f_purchase.getPurchaseToken(), receipt, f_purchase.getSignature());
This is the line that says purchase is a success. It makes sense to acknowledge the purchase before this line.
Add these lines.
//Ashy Custom Code
AcknowledgePurchaseParams acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder().setPurchaseToken(f_purchase.getPurchaseToken()).build();AcknowledgePurchaseResponseListener acknowledgePurchaseResponseListener = new AcknowledgePurchaseResponseListener() { @Override public void onAcknowledgePurchaseResponse(BillingResult billingResult) { //getMessage("Purchase acknowledged"); } }; mBillingClient.acknowledgePurchase(acknowledgePurchaseParams,acknowledgePurchaseResponseListener);
//End of Ashy Custom Code
Purchase is acknowledged and Google is showing an error saying you already own this item when i attempt the purchase again.
I hope Epic fixes this soon. Purchases getting refunded after a week could spell disaster for some people.