In my case I was getting the error from a test class that has an asmdef. I had to add UnityEngine.Purchasing.dll and Stores.dll to the references and the error went away.
That work for me.
Commented the lanes that give me errors, then the project compile in Unity and show you to install things, and then come back to uncoment the code
I noticed the same thing! I just deleted the files that were showing the errors. After deleting the last one, the installer magically started. Interesting. FYI the best forum to post IAP issues is here Unity Services - Unity Discussions
If you are using unity purchasing from an assembly, make sure you add Assembly Definition References to Unity.Purchasing, AND UnityEngine.Purchasing.Stores
Unity 2020.3.34
For anyone upgrading to a newer Unity version I managed to fix the issue by :
1- Make sure the IAP is on under “Services” (Window/General/Services)
2- Delete the folder "Assets/Plugins/UnityPurchasing
3- Comment the lines with errors or simply cut/past the whole class somewhere else, wait the editor to recompile then get back the class
Since I migrate from Unity 2018.4 to 2020.3 I faced the problem with missing StandardPurchasingModule (the same error was with 2021). If you are also using assemblies, then do not forget to add another assembly “UnityEngine.Purchasing.Stores”. In past, it was enough to have only “UnityEngine.Purchasing”. I hope it will saves sometimes time.