To add in-app products, you need to add the BILLING permission to your APK.

I see this on Google Play store developer window after I upload my APK and when I try to go to “IAP” setup section. Do you know what this is?

I already have Unity IAP installed


To add in-app products, you need to add the BILLING permission to your APK.”

1 Like

To properly set up IAP, you need to set it all up BEFORE uploading the APK. You need to configure the products first on Google Play, etc. The instructions are here: Unity - Manual: Configuring for Google Play Store

1 Like

Thank you.

This guide has links to two different scripts.

Do I need IstoreListener script

Or Purchaser script is enough?

Or do I have to have both?

They are the basically the same scripts, they both inherit from iStoreListener. Please refer to the Sample IAP Project here for an example: https://discussions.unity.com/t/700293

the page from that manual is in this order:
-Upload APK
-Add Products on Google Play console.

If the console doesn’t allow us to add products unless the APK is already uploaded, how would we add products first?

I’ve been having an issue where I can’t manually add billing permissions to the apk without overriding Unity’s way of automatically making permissions. I would prefer Unity to make them automatically.

1 Like

No, you need to add your products first, regardless of the documentation. I’ve never needed to explicitly add any permissions.

@JeffDUnity3D I confirm that we have the same error message on play.google.com indicating that we must add the permission and upload a new APK before we can add products. This is probably something which changed on Google side.

1 Like

Actually, it might be the error message on the Google Play Console which is confusing. I believe the requirement is embedded in the UnityIAP library itself (Google Play Faturalandırma Kitaplığı sürüm notları  |  Google Play's billing system  |  Android Developers):

  • Embedded billing permission inside library’s manifest. It’s not necessary to add the com.android.vending.BILLING permission inside Android manifest anymore.

Uploading an APK with UnityIAP should suffice in enabling the IAP section of the Google Play Console.

It should, but I’ve had issues with it as well. I still get the notice from Google Play that my billing permissions aren’t there.

I’ve tried adding products in Unity first as well, but nothing I do is helping.

1 Like

I am having this problem too…

I took things one step further. I downgraded manually to an older version of Unity IAP. (1.18)
I exported the project to Android Studio and manually added the dependencies to my android manifest file and my gradle build…

And THEN I realized that I didn’t click “Start Rollout to Alpha,” which then enabled me to generate my in game products in the Google Play Console.

Looks like the issue was me all along. Most tutorials on this subject are a bit out of date. Make sure you actually roll out your .apk, with the IAP service included and enabled, and ROLL OUT your build to a test channel, then you should be good to go.

:wink:

I was running into the exact same issue when I was trying to upload my aab file. Nothing of the recommended ways worked for me so I tried modifying the android manifest myself.

The comments on here (Android - In App Purchase - you need to add the BILLING permission to your APK - Stack Overflow) suggest that you don’t need to set the permission any more, but I wanted to try anyway.

To modify the xml after Unity created it, I used the following script:

using System.IO;
using System.Text;
using System.Xml;
using UnityEditor.Android;

public class ModifyUnityAndroidAppManifestSample : IPostGenerateGradleAndroidProject
{

    public void OnPostGenerateGradleAndroidProject(string basePath)
    {
        // If needed, add condition checks on whether you need to run the modification routine.
        // For example, specific configuration/app options enabled

        var androidManifest = new AndroidManifest(GetManifestPath(basePath));

        androidManifest.SetBillingPermission();

        // Add your XML manipulation routines

        androidManifest.Save();
    }

    public int callbackOrder { get { return 1; } }

    private string _manifestFilePath;

    private string GetManifestPath(string basePath)
    {
        if (string.IsNullOrEmpty(_manifestFilePath))
        {
            var pathBuilder = new StringBuilder(basePath);
            pathBuilder.Append(Path.DirectorySeparatorChar).Append("src");
            pathBuilder.Append(Path.DirectorySeparatorChar).Append("main");
            pathBuilder.Append(Path.DirectorySeparatorChar).Append("AndroidManifest.xml");
            _manifestFilePath = pathBuilder.ToString();
        }
        return _manifestFilePath;
    }
}


internal class AndroidXmlDocument : XmlDocument
{
    private string m_Path;
    protected XmlNamespaceManager nsMgr;
    public readonly string AndroidXmlNamespace = "http://schemas.android.com/apk/res/android";
    public AndroidXmlDocument(string path)
    {
        m_Path = path;
        using (var reader = new XmlTextReader(m_Path))
        {
            reader.Read();
            Load(reader);
        }
        nsMgr = new XmlNamespaceManager(NameTable);
        nsMgr.AddNamespace("android", AndroidXmlNamespace);
    }

    public string Save()
    {
        return SaveAs(m_Path);
    }

    public string SaveAs(string path)
    {
        using (var writer = new XmlTextWriter(path, new UTF8Encoding(false)))
        {
            writer.Formatting = Formatting.Indented;
            Save(writer);
        }
        return path;
    }
}


internal class AndroidManifest : AndroidXmlDocument {
    private readonly XmlElement ApplicationElement;

    public AndroidManifest(string path) : base(path) {
        ApplicationElement = SelectSingleNode("/manifest/application") as XmlElement;
    }

    private XmlAttribute CreateAndroidAttribute(string key, string value) {
        XmlAttribute attr = CreateAttribute("android", key, AndroidXmlNamespace);
        attr.Value = value;
        return attr;
    }

    internal XmlNode GetActivityWithLaunchIntent() {
        return SelectSingleNode("/manifest/application/activity[intent-filter/action/@android:name='android.intent.action.MAIN' and " +
                "intent-filter/category/@android:name='android.intent.category.LAUNCHER']", nsMgr);
    }

    internal void SetApplicationTheme(string appTheme) {
        ApplicationElement.Attributes.Append(CreateAndroidAttribute("theme", appTheme));
    }

    internal void SetStartingActivityName(string activityName) {
        GetActivityWithLaunchIntent().Attributes.Append(CreateAndroidAttribute("name", activityName));
    }


    internal void SetHardwareAcceleration() {
        GetActivityWithLaunchIntent().Attributes.Append(CreateAndroidAttribute("hardwareAccelerated", "true"));
    }

    internal void SetBillingPermission() {
        var manifest = SelectSingleNode("/manifest");
        XmlElement child = CreateElement("uses-permission");
        manifest.AppendChild(child);
        XmlAttribute newAttribute = CreateAndroidAttribute("name", "com.android.vending.BILLING");
        child.Attributes.Append(newAttribute);
    }
}

It’s basically the script from here (java - Use custom Manifest file and permission in Unity? - Stack Overflow) and only modified the permission line. The script needs to be placed in Assets/Editor/ModifyUnityAndroidAppManifestSample.cs

Google was satisfied with this and I can now add my IAP products.

1 Like

Thanks, but I have never needed to modify the manifest and I’ve published to Google with IAP probably a hundred times, across all versions of IAP.

I had the same issue.
The solution was that just uploading the apk is not enough, you have to release it. So I released it as an “Internal test”. And boom. I can create IAP

3 Likes

Were you able to create IAP after releasing it or after they reviewed it?

This seems to be my problem and the solution for it. Thank you.

Sigh… im hit with this issue as well. Haven’t been able to fix it yet

Describe your issue and steps to reproduce.

Basically go into Google play console and create a new app. It won’t let you create any products.
“Your app doesn’t have any in-app products yet
To add in-app products, you need to add the BILLING permission to your APK.”

This makes 0 sense. Why would I upload an APK with in app purchases that I haven’t created yet?

If we don’t have to manually edit the manifest, then what is the solution? I’ve enabled Unity IAP and uploaded this (useless) update to internal testing. This didn’t resolve the problem.

1 Like

Please don’t mulit-post, I answered in your other post.