Android: Start in app purchase always fails

@GeorgeTheDev_1 My IAP’s are working now, Here how :

Path : ProjectDir/Config/Android/AndroidEngine.ini

[OnlineSubsystem]
DefaultPlatformService=GooglePlay

[OnlineSubsystemGooglePlay.Store]
bSupportsInAppPurchasing=true

[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
bEnableGooglePlaySupport=true
  • Add these in Android Project Settings
    a) Enable For Distribution
    b) Keystore
    c) Games App ID [Play Console → GoTo App → Play Game Services → Configuration → Credentials (Get Resources)]
    d) Add Google Play License Key [Play Console → GoTo App → Monetization Setup]

  • Add Dependency in [ProjectName].Build.cs (If C++ Project)

if (Target.Platform == UnrealTargetPlatform.Android)
        {
            PrivateDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "OnlineSubsystem" });
            DynamicallyLoadedModuleNames.Add("OnlineSubsystemGooglePlay");
        }
  • In Game Start

    • Call ShowExternalLoginUI
  • IAP Execute Event (Execute in same sequence)

    • Read In App Purchase
    • Start In App Purchase
    • Finalize
  • For Testing

    • Add tester mail id which is logged in PlayGames
      Play Console → GoTo App → Play Game Services → Testers

Also you can remove the GET_ACCOUNTS and USE_CREDENTIALS (optional)
Also you have to setup PlayGames support in PlayConsole

2 Likes